producer consumer with sleep and thread safe queue draft