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

Re: [Libevent-users] pending events



On 2010-01-26 18:37, Ron Combs wrote:
I am running 2 events and I would like to run a 3rd event only when both events finished. how can I achieve this?

You want to do something when both events/tasks are finished, i.e. when the last of them finishes. What you need to do is to keep track of what happens using some sort of data structure. When one of these events finish you simply update the data structure (representing the current state) and then check if both tasks are finished by now. If both have finished you do whatever you intend to do (e.g. start something new), otherwise you just wait until the next event occurs.

To be able to access this data structure from within callback functions you can tell libevent to pass a pointer to the data structure as an argument when it calls your callback functions. Please be more specific if you need help with exactly how to do this.

In summary, you will (AFAIK) need to do this yourself. libevent only keeps track of individual events.

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