4 ms·
> feel it's better to just implement multi-threading in your own code (as needed) instead of using something convoluted and confusing like Node.js. What say yo
by biorach 3y ago
> feel it's better to just implement multi-threading in your own code (as needed) instead of using something convoluted and confusing like Node.js. What say you?
I could give a long and detailed answer, but I think the best way is to simply try implement this, in Java or Python (but without using Python's async obviously, which would be just node but worse) and then report back about which is more complicated and convoluted.
Oh and to ensure you're providing the same guarantees as node you should have some test code that a) modifies a variable both in the main and worker threads b) causes exceptions in the worker thread which can be handled in the main thread
For a) I'd suggest using the code here as a starting point:
https://realpython.com/intro-to-python-threading/#race-conditions https://realpython.com/intro-to-python-threading/#race-condi...
After you've done that try the same in idiomatic node