{"action":"created","issue":{"url":"https://api.github.com/repos/StephenCleary/AsyncEx.Coordination/issues/2","repository_url":"https://api.github.com/repos/StephenCleary/AsyncEx.Coordination","labels_url":"https://api.github.com/repos/StephenCleary/AsyncEx.Coordination/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/StephenCleary/AsyncEx.Coordination/issues/2/comments","events_url":"https://api.github.com/repos/StephenCleary/AsyncEx.Coordination/issues/2/events","html_url":"https://github.com/StephenCleary/AsyncEx.Coordination/issues/2","id":149938141,"number":2,"title":"Easier-to-find Synchronous Attempt Functionality","user":{"login":"StephenCleary","id":900597,"avatar_url":"https://avatars.githubusercontent.com/u/900597?v=3","gravatar_id":"","url":"https://api.github.com/users/StephenCleary","html_url":"https://github.com/StephenCleary","followers_url":"https://api.github.com/users/StephenCleary/followers","following_url":"https://api.github.com/users/StephenCleary/following{/other_user}","gists_url":"https://api.github.com/users/StephenCleary/gists{/gist_id}","starred_url":"https://api.github.com/users/StephenCleary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephenCleary/subscriptions","organizations_url":"https://api.github.com/users/StephenCleary/orgs","repos_url":"https://api.github.com/users/StephenCleary/repos","events_url":"https://api.github.com/users/StephenCleary/events{/privacy}","received_events_url":"https://api.github.com/users/StephenCleary/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"StephenCleary","id":900597,"avatar_url":"https://avatars.githubusercontent.com/u/900597?v=3","gravatar_id":"","url":"https://api.github.com/users/StephenCleary","html_url":"https://github.com/StephenCleary","followers_url":"https://api.github.com/users/StephenCleary/followers","following_url":"https://api.github.com/users/StephenCleary/following{/other_user}","gists_url":"https://api.github.com/users/StephenCleary/gists{/gist_id}","starred_url":"https://api.github.com/users/StephenCleary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephenCleary/subscriptions","organizations_url":"https://api.github.com/users/StephenCleary/orgs","repos_url":"https://api.github.com/users/StephenCleary/repos","events_url":"https://api.github.com/users/StephenCleary/events{/privacy}","received_events_url":"https://api.github.com/users/StephenCleary/received_events","type":"User","site_admin":false},"assignees":[{"login":"StephenCleary","id":900597,"avatar_url":"https://avatars.githubusercontent.com/u/900597?v=3","gravatar_id":"","url":"https://api.github.com/users/StephenCleary","html_url":"https://github.com/StephenCleary","followers_url":"https://api.github.com/users/StephenCleary/followers","following_url":"https://api.github.com/users/StephenCleary/following{/other_user}","gists_url":"https://api.github.com/users/StephenCleary/gists{/gist_id}","starred_url":"https://api.github.com/users/StephenCleary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephenCleary/subscriptions","organizations_url":"https://api.github.com/users/StephenCleary/orgs","repos_url":"https://api.github.com/users/StephenCleary/repos","events_url":"https://api.github.com/users/StephenCleary/events{/privacy}","received_events_url":"https://api.github.com/users/StephenCleary/received_events","type":"User","site_admin":false}],"milestone":null,"comments":20,"created_at":"2016-04-21T02:07:41Z","updated_at":"2016-08-16T00:37:48Z","closed_at":"2016-08-16T00:37:48Z","body":"The current AsyncEx library uses [a pattern](http://blog.stephencleary.com/2013/04/cancellationtoken-behavior-with-asyncex.html) where the end-user can pass an already-cancelled `CancellationToken` into any API to achieve a \"synchronous attempt\".\r\n\r\nThe main advantage of this approach is that it keeps the APIs quite clean.\r\n\r\nThe main disadvantages of this approach are that it's not very discoverable and that it can encourage using exceptions for control flow.\r\n\r\nThis issue is a brainstorming of alternatives.\r\n\r\nWhatever solution we adopt will need to be consistent across these APIs:\r\n\r\n    AsyncAutoResetEvent:\r\n      Task WaitAsync(CancellationToken cancellationToken);\r\n    AsyncConditionVariable:\r\n      Task WaitAsync(CancellationToken cancellationToken);\r\n    AsyncLock:\r\n      AwaitableDisposable<IDisposable> LockAsync(CancellationToken cancellationToken);\r\n    AsyncManualResetEvent:\r\n      Task WaitAsync(CancellationToken cancellationToken);\r\n    AsyncMonitor:\r\n      AwaitableDisposable<IDisposable> EnterAsync(CancellationToken cancellationToken);\r\n      Task WaitAsync(CancellationToken cancellationToken);\r\n    AsyncSemaphore:\r\n      Task WaitAsync(CancellationToken cancellationToken);\r\n    PauseToken:\r\n      Task WaitWhilePausedAsync(CancellationToken token);\r\n\r\nas well as these prospective APIs (not currently in this project but will almost certainly be added):\r\n\r\n    AsyncReaderWriterLock:\r\n      AwaitableDisposable<IDisposable> ReaderLockAsync(CancellationToken cancellationToken);\r\n      AwaitableDisposable<IDisposable> WriterLockAsync(CancellationToken cancellationToken);\r\n    AsyncProducerConsumerQueue<T>:\r\n      Task<T> DequeueAsync(CancellationToken cancellationToken);\r\n      Task<DequeueResult> TryDequeueAsync(CancellationToken cancellationToken);\r\n      Task EnqueueAsync(T item, CancellationToken cancellationToken);\r\n      Task<bool> TryEnqueueAsync(T item, CancellationToken cancellationToken);\r\n      Task<bool> OutputAvailableAsync(CancellationToken cancellationToken);\r\n\r\n(`AwaitableDisposable<IDisposable>` is practically the same as `Task<IDisposable>` for the purpose of this conversation).\r\n\r\nNote that the existing `Try*` members on `AsyncProducerConsumerQueue<T>` [are not like `TryLock` (synchronous attempt); rather, they are like `TryParse` (do not throw on error)](https://github.com/StephenCleary/AsyncEx/issues/17). These are going to be renamed.\r\n\r\nSuggestions should have method declarations and usage examples for each of these:\r\n\r\n    void Wait();\r\n    IDisposable Lock();\r\n    DequeueResult Dequeue();\r\n    bool OutputAvailable();\r\n\r\n@roend83 @IanYates @engdata"},"comment":{"url":"https://api.github.com/repos/StephenCleary/AsyncEx.Coordination/issues/comments/239970638","html_url":"https://github.com/StephenCleary/AsyncEx.Coordination/issues/2#issuecomment-239970638","issue_url":"https://api.github.com/repos/StephenCleary/AsyncEx.Coordination/issues/2","id":239970638,"user":{"login":"StephenCleary","id":900597,"avatar_url":"https://avatars.githubusercontent.com/u/900597?v=3","gravatar_id":"","url":"https://api.github.com/users/StephenCleary","html_url":"https://github.com/StephenCleary","followers_url":"https://api.github.com/users/StephenCleary/followers","following_url":"https://api.github.com/users/StephenCleary/following{/other_user}","gists_url":"https://api.github.com/users/StephenCleary/gists{/gist_id}","starred_url":"https://api.github.com/users/StephenCleary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephenCleary/subscriptions","organizations_url":"https://api.github.com/users/StephenCleary/orgs","repos_url":"https://api.github.com/users/StephenCleary/repos","events_url":"https://api.github.com/users/StephenCleary/events{/privacy}","received_events_url":"https://api.github.com/users/StephenCleary/received_events","type":"User","site_admin":false},"created_at":"2016-08-16T00:37:48Z","updated_at":"2016-08-16T00:37:48Z","body":"I've decided for now not to proceed with easier-to-find Synchronous Attempt functionality. However, this exercise did illustrate the difficulty with other `Try*` methods such as `TryDequeueAsync`. As a result of the experiments on the `TryTypes` branch, all `Try*` APIs have been removed. This will make it easier to add Synchronous Attempt APIs if we reconsider this in the future."}}
{"actor":{"display_login":"StephenCleary"}}