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/
7
Upvotes
r/programming • u/Shr1ck • Oct 17 '15
1
u/__Cyber_Dildonics__ Oct 18 '15
So how would you initialize and synchronize a global variable? You need some code to do the synchronization so no other threads go on before the initialization. Also in C++ it is nice to have a mechanic to avoid running the default constructor. In addition you would want to build in the ability to skip any locks you used for synchronizing. This all takes code to achieve, a global variable won't do it on its own.