Got prog5 mostly working, I fixed a lot of errors but I still deadlock
occasionally, I think it's when I'm cleaning up threads

I don't really know exactly what I did to get everything working, I
mostly just played around with futexes untill it worked, I think it's
because I'm working at such a low level that things don't always make
sense in the way then do when you're programming normally