Skip to content

Draft: Fix for Unstable event::pipe_event testcase (#524)

Ingvord requested to merge issue-524 into main

I have played a little bit with the code in #589

And here are some of my thoughts:

  1. If we want to get rid off sleeps that basically means in the code below device->subscribe_event becomes a blocking function which is blocked till the client executes first callback. This is technically achievable but will rely on sync call. Which I am strictly against (there must not be any sync calls during subscription what so ever, but that is a different story)
//
// subscribe to a pipe event
//
		int eve_id1 = device->subscribe_event("RWPipe",Tango::PIPE_EVENT,&cb);
//
// The callback should have been executed once
//
		assert (cb.cb_executed == 1);
  1. due to 1) I would use conditional variables in callback functions to fix this (and maybe others) test(s). I think it is OK, even though C++11 etc as this change will affect only tests and not library code

  2. We can think about improving hand-shake, but I do not see clear benefit vs complexity. The nature of PUB/SUB is that PUB lives its own live sending events, SUBs occasionally appear/disappear receiving some of the events. It MUST be OK for a SUB to miss some events

I will continue with conditional variables approach, while the rest (especially 3) requires severe discussion

Edited by Thomas Braun

Merge request reports