Implemented timed waiting and unconditional pop for queue.
Merge branch 'master' into rpc