In my project I need to mock a blocking function that runs on a thread, I need it to release the thread few times during the tests with my control, on my command, I want it to be blocked most of the time as the read func is in while loop.
class BlockFuncsIf {
public:
    virtual bool Write(const Msg& msg) = 0;
    virtual bool Read(Msg* msg) = 0;
};
class BlockFuncs: public BlockFuncsIf {
public:
    MOCK_METHOD1(Write, bool(const Msg&));
    MOCK_METHOD1(Read, bool(Msg* msg));
};
class TestedClass {
public:
    MSG msg;
    std::condition_variable cv;
    bool success;
    ...
    bool expectRead() {
        success = true;
        while(success) {
            success = Read(&msg);
            cv.notify_all();
        }
    }
    ...
};    
