Hi all,

     I have configured a timer with timer_create() and timer_settime(). Also registered to notify the threads with a pulse when timeout occurs. My issue is, i have only one timer and i need timeout notification to be send to 2 threads. I have registered for notification using SIGEV_PULSE_INIT() with 2 connection IDs


But i am receiving the pulse only in one channel. Is this the expected behavior? Is it possible to receive pulse in 2 channels.


Yes, this is the expected behavior.

Note that SIGEV_PULSE_INIT() is not a routine call, but is a macro that sets up data. So you are overwriting the data with the second line.

But that is not your real problem. A timer will only send one pulse. There are various ways around this.
I would suggest one very simple way around the problem.

Instead of setting the timer, create a thread that does the following:

  1. sleep for the required amount of time
  2. send pulse 1
  3. send pulse 2
  4. exit the thread

For sleep() i would need a dedicated thread, right? To avoid one dedicated thread, i was thinking of such a design. If it does not work, its ok
Consider 2 options:
Option 1: Say i designed a thread and registered to get timer notification pulse. When timeout occurs, thread receives it sends pulse to 2 threads waiting for the timer pulse. So in this design there are altogether 3 threads and one timer.

Option 2: Create 2 timers (for same timeout values), and register to get notification(i.e one timer for one thread). Here, the number of threads is 2, but 2 timers with same timeout value

So which design would you suggest, the 1st or the 2nd.


I think both would work. I like the idea the of the first notified thread notifying the 2nd better, but I doubt there is much difference in the impact.

So increasing the number of timer is more good than creating an additional thread, right ?.
Ok thank you for your opinion


I don’t think it makes much difference. It probably takes more resources to make a thread, but not much.