better semaphores with condition variables, save mouse position