mirror of https://github.com/deavmi/libsnooze
EventSet #1
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What is this?
This is to add anew feature which provides a way for a
Thread
towait()
not only on a single event but a "set" ofEvent
(s).Reason for adding
Someone may want this and it could be handy if one doesn't want to have to spawn multiple threads to do this (alright solution) or (worse solution)
wait(5)
and loop, as that wakes a lot. We have usedselect()
for implementing thewait()
method so adding an "event set" feature shouldn't be hard at all.Would help for tristanable, I guess this isn't feature-request-creep.
This would mean we can tell which events were awoken and compute the difference between that and the events in the original "set".
API
The API should allow one to do something like this:
The
set.wait()
should use select to I/O wait/sleep the process, then when the kernel's IO request is fulfilled we check which fds were awoken, map these to the events that make up theEventSet
; then read of all their bytes; then return theseEvent
(s) in the form of[e1, e2, ...]
(anEvent[]
).