[PATCH v3 3/9] Cygwin: signal: Remove queue entry from the queue chain when cleared
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Dec 3 14:41:45 GMT 2024
On Dec 3 23:01, Takashi Yano wrote:
> The queue is cleaned up by removing the entries having si_signo == 0
> while processing the queued signals, however, sigpacket::process() may
> set si_signo in the queue to 0 of the entry already processed but not
> succeed by calling sig_clear(). This patch ensures the sig_clear()
> to remove the entry from the queue chain. For this purpose, the pointer
> prev has been added to the sigpacket. This is to handle the following
> case appropriately.
>
> Consider the queued signal chain of:
> A->B->C->D
> without pointer prev. Assume that the pointer 'q' and 'qnext' point to
> C, and process() is processing C. If B is cleared in process(), A->next
> should be set to to C in sigpacket::clear().
>
> Then, if process() for C succeeds, C should be removed from the queue,
> so A->next should be set to D. However, we cannot do that because we do
> not have the pointer to A in the while loop in wait_sig().
>
> With the pointer prev, we can easily access A and C in sigpacket::clear()
> as well as A and D in the while loop in wait_sig() using the pointer prev
> and next without pursuing the chain.
Sounds good. The concurrency problem is still open, right?
Thanks,
Corinna
More information about the Cygwin-patches
mailing list