patacongo commented on issue #8899:
URL: https://github.com/apache/nuttx/issues/8899#issuecomment-1484178903

   Hi, @pkarashchenko .  I just noticed the questions.  Sorry, I don't 
subscribe to notifications unless the specifically address me by my username.  
I am not sure I can answer all of these questions as asked.  Let me instead 
talk about the queuing logic itself.  I am a little rusty with this and need 
the refresher anyway:
   
   Signals are not queued.  That is sloppy English.  Most signal handling 
occurs immediately when the signal is received.  For example, if a thread is 
waiting for a signal, then the thread will be awaken immediately upon receipt 
of the signal.
   
   What is really queued is just the signal actions.  Only one signal handler 
can run at once once for a given task.  The queue that hold the pending signal 
actions is called `sigpendactionq`  and the head of this list is in the TCB.
   
   A pending signal action is added to `sigpendactionq`  in 
`nxsig_tcbdispatch()` if a received signal is blocked.
   
   The queue is emptied by a loop in `nxsig_deliver()` which loops, running 
signal handlers until the queue is empty.  It calls up_signal_dispatch which 
sets up signal handler to run via the trampoline` arm_sigdeliver()` for arm.  
When the signal handler returns, this function returns to `nxsig_deliver() 
`which will process the next queued signal handler.
   
   The first question would be:  When POSIX talks about queing signals, are 
they are referring to the same thing?
   
   To emulate Linux behavior, we would simply replace the FIFO `sigpendactionq` 
with a prioritized queue.  The priority would be based on the signal number; 
lower signal numbers have higher priority.  Maybe the priority would be 
SIGRTMAX - signal_number?  In this case, as it is in Linux, the lowered 
standard signals would all have priority of any real time signal.
   
   And alternative would be to have two queues one prioritized like this just 
for real time signals and an non-prioritized FIFO for the standard signals.  
Which would be higher priority?  It would seem like real time signals should 
have higher priority for better real timer performance, but higher priority 
standard signals would behave more like Linux.
   
   Feedback/thoughts/disagreements welcome.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to