On Thu, Jul 30, 2009 at 06:21:03PM +0200, Bas Verhoeven wrote:
 [...]
> 
> But, I gather from that note that it should be possible now?

Indeed it should be!  Did you set up threading on the event_base
before running it?  Is the base notifiable?

You might want to try poking through event.c in the Libevent source to
see how it's meant to work.  event_base_loopexit(base,tv) is an alias for
event_base_once(base, -1, EV_TIMEOUT, event_loopexit_cb, event_base,
tv).

The event_base_once function creates an event and adds it with
event_add which calls event_add_internal.  The synchronization is
meant to happen in event_add_internal, when it says:

      if (res != -1 && !EVBASE_IN_THREAD(base))
         evthread_notify_base(base);

Now, this _should_ wake up the event base, so long as Libevent has
been told about the threading system and it knows how to notify the
base to wake up for stuff.  Since your application uses pthreads, the
easiest way to do this is by making sure to call
evthread_use_pthreads() before you initialize the event_base.

(If you *did* set up locking and thread-ID callbacks before creating
the base, then we have a bug here that we need to solve.)

-- 
Nick

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to