Add support for uthreads blocking on event queues
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 11 Aug 2015 21:12:44 +0000 (17:12 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 28 Sep 2015 19:14:00 +0000 (15:14 -0400)
commit439b046767dabbf73e540bbee605c483212acf16
treef3e62bc9043231a159b074a4cc1f20adad48eb3b
parent9137b0d06ba5d5491301deb49e8810b8f91d0ace
Add support for uthreads blocking on event queues

The generic problem is that we have M uthreads and want to block on a
subset of N event queues.  This is similar to Go's select call.  The
uthread will eventually return with a message from one of the queues.
In the case that multiple evqs fire before the uthread checks the
queues, it'll attempt to extract a message in the order the queues were
listed.

We do this by bypassing the default event handler, which means event
queues that are used for uthreads must be used exclusively for uthreads.
Though technically you can read from the mbox concurrently, a
handle_events() call won't handle any of the messages: that's up to the
uthread.
tests/evq_block.c [new file with mode: 0644]
user/parlib/event.c
user/parlib/include/event.h
user/parlib/include/uthread.h