[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] message loop



I changed the libevent, so that it can be used as I described. The
changes are that I turned event_base_loop in three functions:
- event_base_loop_init
- event_base_loop_process
- event_base_loop_clean

So that the event loop looks like this:
int
event_base_loop(struct event_base *base, int flags)
{
  struct event_base_loop_values *values = event_base_loop_init(base);

  while(!values->done){
    if (event_base_loop_process(base, values, flags) < 0)
      break;
  }
  event_base_loop_clean(base, values);
}

My application loop looks the same only that after the process function
I know can communicate into the kernel space. This simplify the resource
management. I can post the patch if someone has interest in it bud the
changes are quite straight forward. If there are flaws with my approach
please let me know.

thx mosta
On 07/07/11 01:28, Jardel Weyrich wrote:
> The libevent book might help :)
> http://www.wangafu.net/~nickm/libevent-book/Ref3_eventloop.html
> <http://www.wangafu.net/%7Enickm/libevent-book/Ref3_eventloop.html>
>
> On Wed, Jul 6, 2011 at 8:20 PM, mosta <mosta.me
> <http://mosta.me>@googlemail.com <http://googlemail.com>> wrote:
>
>     On 07/06/11 22:32, Mark Ellzey wrote:
>     > On Wed, Jul 06, 2011 at 10:23:57PM +0200, mosta wrote:
>     >> That I run the main loop and call a function that handles what's
>     >> happening in the event base loop.
>     > If I grok this correctly, you are asking whether you can get a
>     list of
>     > currently active events in an event_base?
>     >
>     ***********************************************************************
>     > To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx
>     <mailto:majordomo@xxxxxxxxxxxxx> with
>     > unsubscribe libevent-users    in the body.
>     no, I have on programm  loop and I want to run the event base loop
>     in it.
>     ***********************************************************************
>     To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx
>     <mailto:majordomo@xxxxxxxxxxxxx> with
>     unsubscribe libevent-users    in the body.
>
>

***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.