aerospike / aerospike-client-c

Aerospike C Client
Other
98 stars 103 forks source link

How do you integrate this into a 3rd party event loop? #100

Closed ioquatix closed 1 year ago

ioquatix commented 4 years ago

How do you integrate this into a 3rd party event loop (i.e. non-libev/libevent/libuv).

BrianNichols commented 4 years ago

See https://github.com/aerospike-examples/async-c-tutorial

ioquatix commented 4 years ago

That only appears to show me how to integrate with an existing event loop like libev/libevent/libuv. We have our own event loop which is not one of those.

BrianNichols commented 4 years ago

For a new eventloop framework, you would need to modify the following files:

as_event.{c,h} as_event_internal.h asevent\<your new framework name>.c

Look for #if framework macros and add your own sections for your framework. For example, in as_event.h:

#if defined(AS_USE_LIBEV)
#include <ev.h>
#elif defined(AS_USE_LIBUV)
#include <uv.h>
#elif defined(AS_USE_LIBEVENT)
#include <event2/event_struct.h>
#include <aerospike/as_vector.h>
#else
#endif

Add your include section to this block:

#if defined(AS_USE_LIBEV)
#include <ev.h>
#elif defined(AS_USE_LIBUV)
#include <uv.h>
#elif defined(AS_USE_LIBEVENT)
#include <event2/event_struct.h>
#include <aerospike/as_vector.h>
#elif defined(AS_USE_MYEVENT)
#include <my event include>
#else
#endif

There are quite a few sections to implement, but they should all be located in the given files.