It may happen that a process needs to send a signal to itself to
synchronize on an asynchronous event, e.g., an event triggered by an
interrupt.
In such case we must correctly clear the proc->sig_wait mask.
This fix also improves the signal delivery's performance, because we
don't need to check anymore if we need to skip the delivery to
current_process.
NOTE: we can replace this check with an ASSERT(), if proc->sig_wait is
set the current process can't actively deliver a signal to itself
(it's in sleep state waiting for a signal and can't run by definition).
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3890
38d2e660-2303-0410-9eaa-
f027e97ec537
{
cpu_flags_t flags;
- if (UNLIKELY(proc == current_process))
- return;
-
IRQ_SAVE_DISABLE(flags);
/* Set the signals */
/* Check if process needs to be awoken */
if (proc->sig_recv & proc->sig_wait)
{
+ ASSERT(proc != current_process);
+
proc->sig_wait = 0;
if (wakeup)
proc_wakeup(proc);