Moved to semaphores, threads freeze
Appear to have fixed semaphore problem
Sporadic segfault/freeze on quit, otherwise code appears to be fine