Sure thing: These all assume that you've initialized your arguments as defined in the sirocco structures. Callback (assumes a function named "callback" is defined by the caller, which will take the sir_rv and a user-defined argument "arg_to_callback"): sir_rv rv = sir_write(sirocco_context, peer, key_node, input_args, input_args_count, buffer, output_args, output_args_count, &arg_to_callback, callback); // do other things as necessary, until the callback fires Post and Poll: sir_rv rv = sir_write(sirocco_context, peer, key_node, input_args, input_args_count, buffer, output_args, output_args_count, NULL, NULL); while(sir_wait(rv)) { Sleep(2); //or possibly go do some other necessary thing instead of just sleeping... } Blocking: ssize_t rv = sir_blocking_write(sirocco_context, peer, key_node, input_args, input_args_count, buffer, output_args, output_args_count); -G On 7/26/13 2:52 PM, "Dries Kimpe" <[email protected]> wrote:
* Danielson, Geoffrey Charles <[email protected]> [2013-07-26 20:44:30]:
Attached, find a copy of sirocco.h
The calls do not become non-blocking by virtue of being in a transaction. They become non-blocking by virtue of not blocking the caller until the remote storage server finishes its operation.
Using this API, there are three paths the caller can follow.
Non-blocking - the read and write functions return a context that: 1) if supplied with a callback, will fire the callback when the operation completes (when the storage server returns a status and/or return values).
2) if not supplied with a callback, can be polled by the caller (using sir_wait), until such time as the storage server returns a status and/or return values (when sir_wait will return 0 instead of -1 and setting errno).
Blocking: 3) the blocking_read/blocking_write will block the caller until the operation completes (using pthread signals).
Hope this helps!
Thanks! It does.
To make sure I understand correctly, could you give some code examples (pseudocode is fine) showing how these modes are used?
This will clarify things about context reuse, etc.
THanks, Dries