Replies: 2 comments 11 replies
-
Why is it that every time I ask a question, no one answers the question? This is more than once. Did I ask a bad question? Who can tell me the real reason? Am I being blocked? This is a psychic event.🥶☠ |
Beta Was this translation helpful? Give feedback.
-
I can try to answer some of this for you.
Yes it might, but that isn't your concern. The token is a private value sent to and from the IValueTaskSource implementation. If it overflows, it is up to the IVTS implementation to handle that.
the You can find details on the design here #25182
So....this is a lot of things to await. and more importantly, if you are using TaskCompletionSource, then you are probably not awaiting IO. This is important because if your workload is CPU bound then awaiting these tasks will run a lot slower then just running them sequentially. There may be things you can do about this. Can you share any more details about what kind of processing you need to do?
I don't know much about this, it isn't a public API. It may work for you, but I don't know about your scenario to advise. |
Beta Was this translation helpful? Give feedback.
-
Hello, everyone! I am learning about ValueTask, I have referred to different people's blogs and collected some code, I still want to know some more ingenious uses of ValueTask, because it affects the project I am working on, it needs to be low-allocate.
1、Reset and Version
I have seen some uses of ValueTask, such as:
If I keep using the Reset method, will the Version overflow?
2、 What exactly does the second parameter of ValueTask do?
3、I am now implementing a highly concurrent network scenario. I need to create 100, 000 TaskCompletionSource objects in 1 second to wait for the result of the program scheduling. I wonder if new TaskCompletionSource can be optimized, such as using ValueTask instead.
4、I see that there is an official implementation of ResettableBooleanCompletionSource, which is more like a reasonable solution for low-allocate. May I ask about its usage scenario?
Beta Was this translation helpful? Give feedback.
All reactions