Reason for lcb_update_server_timer

Hi,
In the case where one wants to run its own event loop, one is tempted to replace the lcb_wait calls by stuff like event_base_loop(evbase, 0) or even event_base_loop(evbase, EVLOOP_NONBLOCK) (when the latter is used, it provides a very nice performance improvement by the way). But that might be a bit short sighted, as lcb_wait does a lot more stuff, like calling lcb_update_server_timer. Can you tell me what that is for?

I might also rephrase my question by: what would be the best way for replacing lcb_wait with an event loop. I’m sorry, but the example code from the SDK and the blog posts that go with it are fairly oriented ‘proof that event loops can be used’, not really ‘how event loops must be integrated’.

kind regards,
Hans

Typically lcb_wait in a truly async event loop would be a no-op. In other words, your run_event_loop and stop_event_loop would need to be stub functions that do nothing.

If you want to integrate into an existing event loop, you will need to provide your own iops structure. The default ones included within libcouchbase are all synchronous (from the perspective of user code) and are there to provide various I/O backends.

https://github.com/mnunberg/perl-Couchbase-Client/blob/master/xs/async_events.c

is an example of a truly async event loop. the run_event_loop/stop_event_loop don’t actually modify anything, but instruct the event loop implementation (which is itself abstract) to start/stop monitoring those events registered by libcouchbase; those can be omitted.