Пример #1
0
ClientConsumer::ClientConsumer(
    size_t updatesToGet,
    WorkerThread& worker,
    PipePublisher<Msg>& publisher)
    : done(false), waiting(false), count(0)
{
    std::function<void (Msg&)> task = [&publisher, this, updatesToGet]
                                      (Msg& m) -> void {
        dummy(m);
        this->count += 1;
        if (this->count >= updatesToGet) {
            this->NotifyDone();
        }
    };

    worker.ConsumeUpdates(publisher,task,updatesToGet,1000);
}