OF course it's that easy using phtreads and semaphores

I spent a week trying to hack it myself and I managed to get
everything (bar some non thread related issues with the heapsort)
working using pthreads in a couple hours. damnit.