Taken from Multithreaded programming - theory and practice on reddit, which also has some very funny comments. If anything this is way too organized.
What's not shown? All the little messes that have to be cleaned up after...