implementation of producer–consumer problem on C++11