You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ConcurrentQueue handles all synchronization internally, so it's not clear why SemaphoreSlim is used here. Can you please add a sentence describing why it is required?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: c3460b0d-9c60-3a06-ac63-18cf990e53c3
Version Independent ID: b2dece1f-15b8-03af-6d52-7cc070432b4b
I can't say outside of their goal to base it on QueueBackgroundWorkItem. SemaphoreSlim is used in their BackgroundTaskQueue example. They plan to port QueueBackgroundWorkItem to Core for 3.0. The topic sample was based on a prototype, and there's an issue for that, as well. I recommend that you ask over on the aspnet/Hosting issue (it's still open for discussion), and one of the engineers will probably answer.
TryDequeue in ConcurrentQueue returns false if there are no items in the queue. So SemaphoreSlim is used here to block executing of ExecuteAsync method until some workItem is pushed in QueueBackgroundWorkItem method.
Probably you can use BlockingCollection here instead.
Anyway it is just an example, as @guardrex mentioned - it is taken from aspnet/Hosting#1280
Thanks for contacting us. We believe that the question you've raised have been answered. If you still feel a need to continue the discussion, feel free to reopen it and add your comments.
ConcurrentQueue
handles all synchronization internally, so it's not clear whySemaphoreSlim
is used here. Can you please add a sentence describing why it is required?Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: