I'm developing a control system that uses libuv (1.34.2) on a GNU/Linux 
system. My control system basically has a mutex-protected in-memory message 
queue, posts my custom messages to it, and calls async_send(). The handler 
is an async handler run by the main loop.

You could think of each message as more or less corresponding to single, 
non-blocking function to be called in the main loop. So the handler pops a 
message off, uses it to decide what non-blocking function to call, and 
calls it.

The problem I want to solve is that if I get a bunch of messages all at 
once in the queue (eg. after libuv coalesces async_send calls, or my 
control code posts multiple messages at once), I (a) don't want to 
monopolise the mutex and (b) don't want to monopolise the main loop. (a) is 
solved by popping the messages off the queue, storing them, releasing the 
mutex and then processing the messages outside the mutex lock. But (b) is a 
bit harder. I want to let libuv handle other things in between the function 
call for each message (if it needs to).

Is there a way to give libuv a function to run once, queued up in the main 
loop? I couldn't find any API functions that simply add a one-off function 
call to the loop.

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to libuv+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/libuv/a3444d2a-ea5d-4042-b379-7cea75b5b81do%40googlegroups.com.

Reply via email to