Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Question about synchronization of real-time threads by signals.: (3 Items)
   
Question about synchronization of real-time threads by signals.  
 • Hello.

Question about synchronization of real-time  threads by signals.
Test task: 
- create 2 real-time streams.
 - the interval for starting the thread is provided by an interval timer. 
- each thread has its own timer, time interval, priority, and real-time signal (from   SIGRTMIN ...SIGRTMAX range). 
When the time interval expires, the timer generates an event with its own number.
The thrrad is waiting for a signal from the timer ( sigwait (&set, &sigw);). When the timer signal arrives, the thread 
must perform certain operations (I have an increased counter). If you use special sigrtmax + 7 or SIGRTMAX + 8 signals 
in the task, the task is completed. If you use real-time signals SIGRTMIN+1, SIGRTMIN+2, the task is not performed. the 
Threads go to SUSPEND mode and work only when you click the RESUME button. (see the screenshot ) 
In this process, real-time signals are converted into special signals according to the documentation. (Real-time 
operating system QNX Neutrino 6.5. System architecture. Inter-task interaction in QNX Neutrino OS. Events.) 
Text from the program:
struct sigaction action;

sigemptyset(&set);

sigaddset(&set,SIGNALTIMER100);

sigaddset(&set,SIGNALTIMER50);

act.__sa_un._sa_handler= SIG_DFL;

act.sa_flags =SA_SIGINFO;

sigaction(SIGNALTIMER100, &act, NULL);

sigaction(SIGNALTIMER50, &act, NULL);

sigprocmask(SIG_BLOCK, &set, NULL);//

Tell me where the error is ? 
Can you give a link to an example of implementing such threads? 
Why signals don't become "special".
 I attach the program text.

   
Attachment: Text SignalTest.cpp 5.55 KB Image Снимок1.PNG 37.32 KB
Re: Question about synchronization of real-time threads by signals.  
If you run under the debugger, then it catches all signals by default. Try to run your program szand-alone on the target
. Does it work then?

Regards,
Albrecht
Re: Question about synchronization of real-time threads by signals.  
I tried your code, and sigwait() is definitely returning as a result of the signals generated by the timer. I don't know
 what you expect to happen, though, as the threads will be stuck in an infinite loop no matter what:

====================================
   loop:


      if(sigwait(&set, &sigw))
      // if ((SignalWaitinfo(&set,0))==-1)
        {
          goto loop;
      }
  //    printf("\nAfter In Loop 50\n");

      VCount50++;

 goto loop;
=====================================

So every time a signal is generated (and you have a periodic timer for each thread) the code ends up jumping back to the
 loop label.

--Elad