Added basic threads and safe producer-consumer queue