move condition check to after wait()
make size member in queue atomic