![]() |
Generic asynchronous events abstraction. Designed to support multiple event libraries. Only one library is supported per build.
Data Structures | |
struct | as_event_loop |
Functions | |
bool | as_event_close_loops () |
as_event_loop * | as_event_create_loops (uint32_t capacity) |
void | as_event_destroy_loops () |
as_event_loop * | as_event_loop_find (void *loop) |
static as_event_loop * | as_event_loop_get () |
static as_event_loop * | as_event_loop_get_by_index (uint32_t index) |
as_event_loop * | as_event_set_external_loop (void *loop) |
bool | as_event_set_external_loop_capacity (uint32_t capacity) |
bool as_event_close_loops | ( | ) |
Close internal event loops and release watchers for internal and external event loops. The global event loop array will also be destroyed for internal event loops.
This method should be called once on program shutdown if as_event_create_loops() or as_event_set_external_loop_capacity() was called.
The shutdown sequence is slightly different for internal and external event loops.
Internal:
External:
as_event_loop* as_event_create_loops | ( | uint32_t | capacity) |
Create new event loops. This method should only be called when asynchronous client commands will be used and the calling program itself is not asynchronous. If this method is used, it must be called before aerospike_connect().
capacity | Number of event loops to create. |
void as_event_destroy_loops | ( | ) |
Destroy global event loop array. This function only needs to be called for external event loops.
as_event_loop* as_event_loop_find | ( | void * | loop) |
Find client's event loop abstraction given the external event loop.
loop | External event loop. |
|
inlinestatic |
Retrieve a random event loop using round robin distribution.
Definition at line 225 of file as_event.h.
References as_event_loop::next.
|
inlinestatic |
Retrieve event loop by array index.
index | Event loop array index. |
Definition at line 212 of file as_event.h.
References as_event_loop::index.
as_event_loop* as_event_set_external_loop | ( | void * | loop) |
Register an external event loop with the client. This method should be called when the calling program wants to share event loops with the client. This reduces resource usage and can increase performance.
This method must be called in the same thread as the event loop that is being registered.
This method is used in conjunction with as_event_set_external_loop_capacity() to fully define the external loop to the client and obtain a reference the client's event loop abstraction.
loop | External event loop. |
bool as_event_set_external_loop_capacity | ( | uint32_t | capacity) |
Set the number of externally created event loops. This method should be called when the calling program wants to share event loops with the client. This reduces resource usage and can increase performance.
This method is used in conjunction with as_event_set_external_loop() to fully define the the external loop to the client and obtain a reference the client's event loop abstraction.
capacity | Number of externally created event loops. |