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

[Libevent-users] priorities and bases for different threads



From the online documentation:

"Active events with a lower priority are always processed before events with a higher priority.

Does is apply across multiple bases with multiple threads?

Example:

  • Thread A and Thread B each have their own bases and each use event_base_priority_init(<base>, 5) on their bases
  • Thread A creates an event with priority 2
  • Thread B creates an event with priority 0
  • Tons of packets come in to Thread A’s event queue.  It starts processing them, occasionally writing data to the pipe that Thread B has its 0 priority event on, but there are still many packets already queued up for Thread A’s event queue

I’m hoping what happens here is that once Thread A writes to the pipe that Thread B has its 0 priority event on, Thread B will pick up that event from its base before more of Thread A’s base continues to feed Thread A its events.

Do I have that right?

Thanks!


- scott