Esempio n. 1
0
static FAR sigpendq_t *sig_addpendingsignal(FAR struct tcb_s *stcb,
                                            FAR siginfo_t *info)
{
  FAR struct task_group_s *group;
  FAR sigpendq_t *sigpend;
  irqstate_t flags;

  DEBUGASSERT(stcb != NULL && stcb->group != NULL);
  group = stcb->group;

  /* Check if the signal is already pending for the group */

  sigpend = sig_findpendingsignal(group, info->si_signo);
  if (sigpend)
    {
      /* The signal is already pending... retain only one copy */

      memcpy(&sigpend->info, info, sizeof(siginfo_t));
    }

  /* No... There is nothing pending in the group for this signo */

  else
    {
      /* Allocate a new pending signal entry */

      sigpend = sig_allocatependingsignal();
      if (sigpend)
        {
          /* Put the signal information into the allocated structure */

          memcpy(&sigpend->info, info, sizeof(siginfo_t));

          /* Add the structure to the group pending signal list */

          flags = enter_critical_section();
          sq_addlast((FAR sq_entry_t *)sigpend, &group->tg_sigpendingq);
          leave_critical_section(flags);
        }
    }

  return sigpend;
}
Esempio n. 2
0
static FAR sigpendq_t *sig_addpendingsignal(FAR struct tcb_s *stcb,
                                            FAR siginfo_t *info)
{
  FAR struct task_group_s *group = stcb->group;
  FAR sigpendq_t *sigpend;
  irqstate_t saved_state;

  DEBUGASSERT(group);

  /* Check if the signal is already pending */

  sigpend = sig_findpendingsignal(group, info->si_signo);
  if (sigpend)
    {
      /* The signal is already pending... retain only one copy */

      memcpy(&sigpend->info, info, sizeof(siginfo_t));
    }

  /* No... There is nothing pending for this signo */

  else
    {
      /* Allocate a new pending signal entry */

      sigpend = sig_allocatependingsignal();
      if (sigpend)
        {
          /* Put the signal information into the allocated structure */

          memcpy(&sigpend->info, info, sizeof(siginfo_t));

          /* Add the structure to the pending signal list */

          saved_state = irqsave();
          sq_addlast((FAR sq_entry_t*)sigpend, &group->sigpendingq);
          irqrestore(saved_state);
        }
    }

  return sigpend;
}