Couchbase C Client
3.3.14
Asynchronous C Client for Couchbase
|
Functions for synchronous I/O execution
The lcb_wait() family of functions allow to control when the library sends the operations to the cluster and waits for their execution.
It is also possible to use non-blocking I/O with the library
lcb_STATUS lcb_tick_nowait | ( | lcb_INSTANCE * | instance | ) |
Like lcb_wait(), callbacks for operations may be delivered here, however some operations may be left incomplete if their I/O could not be processed immediately. This function is intended as an optimization for large batches of operations - so that some I/O can be completed during the batching process itself, and only the remainder of those operations (which would have blocked) will be completed with lcb_wait() (which should be invoked after the batch).
This function is mainly useful if there is a significant delay in time between each scheduling function, in which I/O may be completed during these gaps (thereby emptying the socket's kernel write buffer, and allowing for new operations to be added after the interval). Calling this function for batches where all data is available up-front may actually make things slower.
lcb_STATUS lcb_wait | ( | lcb_INSTANCE * | instance, |
lcb_WAITFLAGS | flags ) |
Wait for completion of scheduled operations.
instance | the instance |
flags | flags to modify the behavior of lcb_wait(). Pass 0 to obtain behavior identical to lcb_wait(). |
void lcb_breakout | ( | lcb_INSTANCE * | instance | ) |
Forcefully break from the event loop.
You may call this function from within any callback to signal to the library that it return control to the function calling lcb_wait() as soon as possible. Note that if there are pending functions which have not been processed, you are responsible for calling lcb_wait() a second time.
instance | the instance to run the event loop for. |
int lcb_is_waiting | ( | lcb_INSTANCE * | instance | ) |
Check if instance is blocked in the event loop.
instance | the instance to run the event loop for. |
enum lcb_WAITFLAGS |
Flags for lcb_wait()
Enumerator | |
---|---|
LCB_WAIT_DEFAULT | Behave like the old lcb_wait() |
LCB_WAIT_NOCHECK | Do not check pending operations before running the event loop. By default lcb_wait() will traverse the server list to check if any operations are pending, and if nothing is pending the function will return without running the event loop. This is usually not necessary for applications which already only call lcb_wait() when they know they have scheduled at least one command. |