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

Needs the ability within an ISyncScope to Pulse and Wait. #2

Open
ppervink opened this issue Feb 3, 2019 · 0 comments
Open

Needs the ability within an ISyncScope to Pulse and Wait. #2

ppervink opened this issue Feb 3, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ppervink
Copy link
Owner

ppervink commented Feb 3, 2019

Needs a thread-independent way to do the following (modeled after Monitor.Wait and Monitor.Pulse):

  • Wait - temporarily allow queued Acquire and TryAcquire calls to proceed while waiting for a pulse, blocking the caller until any ISyncScope(s) acquired while waiting are disposed and at least one Pulse has occurred.

    • There is much yet to be considered with the mechanics of multiple threads potentially holding an ISyncScope within the same ISyncContext on the same synchronization root (ISyncScope.SyncRoot).
    • This is further complicated in that I'm considering a mechanic to pass an ISyncScope from one context to another and/or temporarily join multiple ISyncContext instances.
  • Pulse - flag to, once the ISyncScope is disposed, notify any blocking Wait calls that something changed, allowing them to proceed.

    • One potential thought in this area would be to have Pulse re-insert any contexts from a Wait call back into the awaiters queue
    • Another thought is to fire any WaitAsync caller continuations via ThreadPool.QueueUserWorkItem or captured caller's synchronization context at the end of the call.
  • WaitAsync - return an awaitable interface that allows other Acquire and TryAcquire calls to proceed while waiting for a pulse. When a pulse is received, the continuation would be called asynchronously in a manner consistent with the behavior of Wait (TBD).

@ppervink ppervink added the enhancement New feature or request label Feb 3, 2019
@ppervink ppervink self-assigned this Feb 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant