Next: Using External Event Loops, Up: Run Control
The function
gpgme_wait
continues the pending operation within the context ctx. In particular, it ensures the data exchange between GPGME and the crypto backend and watches over the run time status of the backend process.If hang is true, the function does not return until the operation is completed or cancelled. Otherwise the function will not block for a long time.
The error status of the finished operation is returned in status if
gpgme_wait
does not returnNULL
.The ctx argument can be
NULL
. In that case,gpgme_wait
waits for any context to complete its operation.
gpgme_wait
can be used only in conjunction with any context that has a pending operation initiated with one of thegpgme_op_*_start
functions exceptgpgme_op_keylist_start
andgpgme_op_trustlist_start
(for which you should use the correspondinggpgme_op_*_next
functions). If ctx isNULL
, all of such contexts are waited upon and possibly returned. Synchronous operations running in parallel, as well as key and trust item list operations, do not affectgpgme_wait
.In a multi-threaded environment, only one thread should ever call
gpgme_wait
at any time, irregardless if ctx is specified or not. This means that all calls to this function should be fully synchronized by locking primitives. It is safe to start asynchronous operations while a thread is running ingpgme_wait
.The function returns the ctx of the context which has finished the operation. If hang is false, and the timeout expires,
NULL
is returned and*status
will be set to 0. If an error occurs,NULL
is returned and the error is returned in*status
.