Created
October 7, 2020 12:44
-
-
Save stevejgordon/2a9dae86170e88d522195e564198d4e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (blockedReader != null) | |
| { | |
| // Complete the reader. It's possible the reader was canceled, in which | |
| // case we loop around to try everything again. | |
| if (blockedReader.TrySetResult(item)) | |
| { | |
| return true; | |
| } | |
| } | |
| else | |
| { | |
| // Wake up all of the waiters. Since we've released the lock, it's possible | |
| // we could cause some spurious wake-ups here, if we tell a waiter there's | |
| // something available but all data has already been removed. It's a benign | |
| // race condition, though, as consumers already need to account for such things. | |
| ChannelUtilities.WakeUpWaiters(ref waitingReadersTail, result: true); | |
| return true; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment