(e)poll takeover
From: Hans Henrik Happe
Date: Wed Jun 28 2006 - 11:30:39 EST
Hi
I have tried to find a way to have a thread take over the event waiting from
another thread. This should be done without context switching.
A more precise description:
1. Thread A are waiting in poll or epoll.
2. Thread B decides to take over the waiting. This means stopping thread A
from responding to new events and go into a (e)poll for the same events.
3. After handling some events thread B decides to let thread A take over
again.
This should be done without context switching. At least in step 3.
The only way I can think of is using two epoll fd's (e0 and e1). e0 should
just contain e1 and e1 should contain the actual events:
Thread A:
epoll_wait(e0)
epoll_wait(e1)
/*handle events*/
Thread B (takeover):
epoll_ctl(e0, remove e1)
epoll_wait(e1)
/*handle events*/
.
.
epoll_ctl(e0, add e1)
I have left out the synchronization.
Is there a better way to do this. Perhaps one that also work with plain
poll().
Hans
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html