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

Get list of queued items in AsyncQueue #986

Closed
n9 opened this issue Feb 8, 2022 · 6 comments · Fixed by #987
Closed

Get list of queued items in AsyncQueue #986

n9 opened this issue Feb 8, 2022 · 6 comments · Fixed by #987

Comments

@n9
Copy link

n9 commented Feb 8, 2022

Is your feature request related to a problem? Please describe.

I want to get an ordered list of queued items in AsyncQueue.

Describe the solution you'd like

I would be nice to have a method that would return the ordered list of queued items.

Describe alternatives you've considered

I have not found any public members that can be used to achieve that.

@AArnott
Copy link
Member

AArnott commented Feb 8, 2022

Can you share your scenario that would need such an API? The primary use case for this class does not require this.

@n9
Copy link
Author

n9 commented Feb 8, 2022

Sure. My scenario is following:

I am using it for a very simple task queue.
I/users would like to see what items/tasks are waiting.

(I know that there is currently no update information.)

@AArnott
Copy link
Member

AArnott commented Feb 8, 2022

Thanks. And would Queue<T> or List<T> make an adequate substitute for your use case?

@n9
Copy link
Author

n9 commented Feb 8, 2022

I do not want to block a thread while waiting for a new task. The task queue is empty most of the time. Tasks are queued only occasionally.

@AArnott
Copy link
Member

AArnott commented Feb 8, 2022

The work may not be trivial, given exposing the inner collection would introduce a thread-safety problem so we would likely need to copy the collection within a lock and then return it. I can't promise a timeline or whether we'll get to this feature request at this point.

n9 pushed a commit to n9/vs-threading that referenced this issue Feb 8, 2022
@n9
Copy link
Author

n9 commented Feb 8, 2022

I have mocked a PR: #987.

n9 pushed a commit to n9/vs-threading that referenced this issue Feb 8, 2022
@AArnott AArnott linked a pull request Feb 11, 2022 that will close this issue
AArnott added a commit that referenced this issue Feb 11, 2022
AsyncQueue<T>.ToArray() made public (#986)
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

Successfully merging a pull request may close this issue.

2 participants