[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] How to activate read callback when not all data was read
On Tue, Apr 10, 2012 at 8:04 PM, Nir Soffer <nirsof@xxxxxxxxx> wrote:
>
> On Apr 10, 2012, at 6:33 PM, Nick Mathewson wrote:
>
> Instead you can simply say:
>
> ev = event_new(base, -1, 0, process_work_queue_cb, NULL);
> event_active(ev, EV_TIMEOUT, 1);
>
> The second approach is better because it doesn't require you to put
> the event in the timeout heap at all: instead, Libevent sees that
> you're activating the event, and puts it right in the queue of active
> events.
>
>
> Can you call event_activate from another thread as a way to wakeup the event
> loop from another thread?
Yes, that should work, assuming that threads have been enabled
properly, and you're running Libevent 2.0.10-stable or later.
(For historical reasons, it's event_active, not event_activate.)
cheers,
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.