[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
RE: [Libevent-users] Forwarding events to a different event base.
Hi Nick,
> > So, given the latest rc does not support listener sockets under
> Win
> > IOCP (unless that has changed),
>
> Are you talking about the IOCP based evconnlistener stuff? It's
> supposed to be working; if it isn't, you should open a bug on the
> tracker.
I tried it last rc (maybe 2 ago) and it was non-functional, or at
least I never got any connection events when I used an IOCP backend.
> > lacking in "why" it exists.
>
> Which items are you talking about here? Which documentation? Have you
> seen the documentation at http://www.wangafu.net/~nickm/libevent-book/
Yip, live with that documentation but it doesn't cover the idea of
taking an event from one event_base and pushing it to another event_base.
On the other hand, if things are working as you suggest I eat crow and stop
worrying about it. :) I'll give it a test hopefully tomorrow, figure
1024*10 connection/disconnections should prove it is working correctly. :)
> > The other option I see to solve this is to cache the event data
> into
> > a new structure and call event_base_once on the other event base in
>
> If I understand right, this is your actual question: You have code in
> one thread that wants some other code to execute as part of the thread
> running the event_base loop.
As the second part of this, yes. I had not updated my 2.0rc for a
while and listeners were not working in IOCP at that time, I seem to have
missed the notification that it had been fixed.
> If you're going to be calling event_active from another thread,
> remember that you'll need to be using Libevent 2.0, and you'll need to
> set up threading functions. (See chapter 1 of that manual.)
Sorry, should have stated 2.0 latest rc as my platform. (I started
this on rc 1 or 2 though and listeners were not supported by IOCP according
to the documentation.) I wrote some code for an old libevent once, I'm
writing some more interesting code using the 2.0 rc's now though. After the
issues with 1.4ish stuff and threading I gave up and wrote a Win32 only
version. 2.0 sounds like, and so far with the help of the preliminary
manual and generally good commenting in the code, I'll have a nice x-plat
version in the next couple weeks.
But, this is all helpful since I'd rather send the very rare events
beyond networking and timers through the same event loop and not have to
deal with multithreading outside of the workers. I'm not worried about
latency and performance for these added events, as stated, they are rare.
Thanks for the info, if listeners and IOCP don't work, you will hear
back sometime tomorrow. :)
KB
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.