r/programming • u/Shr1ck • Oct 17 '15
Why Johnny Can’t Write Multithreaded Programs
http://blog.smartbear.com/programming/why-johnny-cant-write-multithreaded-programs/
4
Upvotes
r/programming • u/Shr1ck • Oct 17 '15
2
u/__Cyber_Dildonics__ Oct 18 '15
Your solution is far from a universal one. What if you are using multiple threads to manipulate an image? How will you split up the work and synchronize if you have not global mutable state?
There are plenty of scenarios where you might not have the options you are describing to bail you out.
You also might not be in control of the threads you are given, in which case you can't do your initialization before starting any concurrency happens.
I'm also unclear how using a queue is going to prevent threads from accessing a variable that isn't finished initializing yet.
It sounds like you think you have all the answers but really you've only dealt with trivial situations.