c++ - Avoid buffering in ZMQ for a determined time? -
we reading messages kinect broadcasting in zmq.
we use more or less following code:
socket_t subscriber_eeg(context, zmq_sub); subscriber_eeg.connect("tcp://127.0.0.1:5559"); while(true) { random stuff if (pressedpause) { //shows message continue; } subscriber.recv(&kinect_msg); //code process message //code plot hand movements. }
the objective pause execution of code on given event pressed pause. pause event running on thread independently.
everything works fine, problem that, since zmq buffers messages, starts plotting every movement captured in paused state.
is there way tell zmq stop receiving message in event of pause, or clear buffer?
just toggle connection state:
subscriber.connect("tcp://127.0.0.1:5559"); //do work //user presses 'pause' subscriber.disconnect("tcp://127.0.0.1:5559"); //user un-'pauses' subscriber.connect("tcp://127.0.0.1:5559");
i tested separate threads, when subscriber wakes up, not rerieve messages sent during disconnected state.
Comments
Post a Comment