Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow watchers to generate completions without adding them to the loop. #123

Open
bhansconnect opened this issue Oct 19, 2024 · 0 comments

Comments

@bhansconnect
Copy link

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:

loop.add(c);

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant