Lock and condition variable included(condition variable wasn't tested)