Description
This is a general design request. I think it would be nice to all the various watchers to fill out completions without adding them to a loop. I am working on a multithreaded system, where the main loop is behind lock. As such, I don't want threads to always lock due to calling loop.add
. Instead it would be preferable to just create a completion. Later, the lock can be grabbed and loop.add
called.
As such, it would be nice to have a version of the watcher functions that doesn't call loop.add
. The simplest solution would be to change loop: *xev.Loop
to a loop: ?*xev.Loop
. If the loop is null, no add function is called. where be a modification here and in other equivalent functions:
Line 130 in b8d1d93
to something like:
if (loop) |l| {
l.add(c);
}
That said, it may be nicer to fully split out the api and make two different calls. One that just fills out the completion and one that actually adds to the loop.
Thoughts?