4 ms·
Question, how do other concurrent languages like Java or C# handle the concept of 'thread context', and cancellation? To me it sounds like having to pass a con
by camus2 9y ago
Question, how do other concurrent languages like Java or C# handle the concept of 'thread context', and cancellation?
To me it sounds like having to pass a context everywhere is something that should be handled on the language level, just as concurrency.
- knodi 9y agoyes, like an expended channel reference. This way you can open up this reference to handle channel management/cancellations.
- SamReidHughes 9y agoIn RethinkDB which is C++ with a home rolled m:n threads library, it passes in an "interruptor" which is like a one shot chan struct{} you can wait upon or select over with other chans. The main difference is that the functions which take an interruptor and throw an interrupted_exc_t exception. You could add language support for doing this sort of stuff automatically, or very conveniently, though it would need a bit of care when lambdas or closures get involved.