David Richardson
2009-07-11 00:06:14 UTC
I'm using librapi for some really cool testing framework stuff at Flexilis.
I'm really trying to push the limits of the library. I've wrapped librapi
in ruby using Ruby::DL but currently I have to mutex on any RAPI call. I'd
really like to only have to mutex per-device. Ruby only uses green threads
so the existing thread safe stuff isn't going to help me, I believe. I want
to run tests on hundreds of devices in parallel.
What I want to do is create alternative wrappers for each RAPI function
where I pass the context in as the last parameter, rather than specifying it
ahead of time with . I tried some initial experimentation with this
yesterday, but didn't have much luck. Before I dive too deep into it, I
wanted to make my proposal and hear any comments you have. Specifically I'm
concerned about how the contexts work and when/how they become invalidated.
Serially I will create each connection (rapi_connection_from_name), select
it (rapi_connection_select), initialize it (CeRapiInit) and store the
current context (get_current_context). Then in parallel I will call
modified RAPI functions on hundreds of devices that take the context in as a
paramater.
I notice that the act of selecting a connection unref's the previously
selected connection and destroys it (since this was the only reference). Is
it sufficient for me to just store a reference to each context and call
rapi_context_ref (and unref when I'm done)? Is there anything else that
would invalidate the previous context?
I'll hopefully be experimenting with this sometime next week. Is this a
change that others would be interested in contributing toward librapi's
trunk? Do you have a suggestion of a better way to go about this? Is
there maybe some existing functionality that I'm missing that already allows
this?
Thanks!
-David Richardson
Flexilis Mobile Security
I'm really trying to push the limits of the library. I've wrapped librapi
in ruby using Ruby::DL but currently I have to mutex on any RAPI call. I'd
really like to only have to mutex per-device. Ruby only uses green threads
so the existing thread safe stuff isn't going to help me, I believe. I want
to run tests on hundreds of devices in parallel.
What I want to do is create alternative wrappers for each RAPI function
where I pass the context in as the last parameter, rather than specifying it
ahead of time with . I tried some initial experimentation with this
yesterday, but didn't have much luck. Before I dive too deep into it, I
wanted to make my proposal and hear any comments you have. Specifically I'm
concerned about how the contexts work and when/how they become invalidated.
Serially I will create each connection (rapi_connection_from_name), select
it (rapi_connection_select), initialize it (CeRapiInit) and store the
current context (get_current_context). Then in parallel I will call
modified RAPI functions on hundreds of devices that take the context in as a
paramater.
I notice that the act of selecting a connection unref's the previously
selected connection and destroys it (since this was the only reference). Is
it sufficient for me to just store a reference to each context and call
rapi_context_ref (and unref when I'm done)? Is there anything else that
would invalidate the previous context?
I'll hopefully be experimenting with this sometime next week. Is this a
change that others would be interested in contributing toward librapi's
trunk? Do you have a suggestion of a better way to go about this? Is
there maybe some existing functionality that I'm missing that already allows
this?
Thanks!
-David Richardson
Flexilis Mobile Security