3 ms·
Threads are not hard. In fact, threads are extremely easy to implement. However, real Threading code is just incredibly difficult to reason, just by looking at
by devxpy 8y ago
Threads are not hard.
In fact, threads are extremely easy to implement.
However, real Threading code is just incredibly difficult to reason, just by looking at it. This makes it easy for you to introduce race conditions without even knowing that there is one!
There is also the fact that locks don't lock anything!
They are just a flag, that a any code may choose to ignore.
They are a not an enforcing tool, just a cooperative one.
(More here: https://www.youtube.com/watch?v=9zinZmE3Ogk https://www.youtube.com/watch?v=9zinZmE3Ogk)
P.S. I created a library, that makes it easier to write safer multiprocessing code
https://github.com/pycampers/zproc https://github.com/pycampers/zproc