Open viceice opened 4 years ago
There is currently no way to do this. Promise
is a simple wrapper forTask
. There is no object in which all created Promises
are stored for a number of reasons. You can make your own solution for this.
Can the promises cause multi threading issues? eg when i create a list of them and await them all? Are they guaranteed to not run on seperate threads, like in nodejs, where we only have a single thread?
It sounds not good, but no, we have no guarantees. Each promise will be evaluated in separate thread. This is because Promise
in current implementation is just a wrapper for System.Threading.Tasks.Task
.
Yes, promises can cause some multi threading issues
And i can't override the Promise implementation, as it's pretty hard wired. 😕
So, lets fix this.
Please, look at #262. Is it possible to override Promise
after these changes?
How do I await all unsettled promises after
Context.Run()
?js code
cs code