Hey Martin, Events are never just there - there usually is a syscall involved to ask the OS that blocks the thread until any event arrives (although there are some special cases). Libuv supports many types of events, so if you need to receive an event there's probably a way to do it with libuv.
If you have another type of event, the way to make libuv receive it depends on the mechanism that's used by the kernel to deliver it to the user mode application. In the case of system shutdown, unix-like systems usually deliver that event via a signal, so you can use uv_signal to receive it. If you pick up an event in another thread and you want to dispatch it to the libuv thread, there's uv_async for that. But I don't know what event you are dealing with. Care to share that with us? - Bert On Saturday, May 10, 2014 4:07:58 PM UTC+2, Martin Sustrik wrote: > > Hi, > > I start the event loop, it does what it should, everything works OK. > > Now I want to pass some user events to the event loop. E.g. "User pressed > shutdown button and I want the event loop to terminate", "I want to get the > processing results accumulated so far" or similar. > > I can create an eventfd, register a callback for it, then I can signal the > eventfd and wait till the callback is invoked. > > However, it feels like libuv should have a canonical way of doing that. > Does it? And if so, how? > > Martin > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
