Add condition to threading
Replace pthread variable in queue with lock and condition