Exemple #1
0
void sig_initialize(void)
{
  /* Initialize free lists */

  sq_init(&g_sigfreeaction);
  sq_init(&g_sigpendingaction);
  sq_init(&g_sigpendingirqaction);
  sq_init(&g_sigpendingsignal);
  sq_init(&g_sigpendingirqsignal);

  /* Add a block of signal structures to each list */

  g_sigpendingactionalloc =
     sig_allocateblock(&g_sigpendingaction,
                       NUM_PENDING_ACTIONS,
                       SIG_ALLOC_FIXED);

  g_sigpendingirqactionalloc =
     sig_allocateblock(&g_sigpendingirqaction,
                       NUM_PENDING_INT_ACTIONS,
                       SIG_ALLOC_IRQ);

  sig_allocateactionblock();

  g_sigpendingsignalalloc =
     sig_allocatependingsignalblock(&g_sigpendingsignal,
                             NUM_SIGNALS_PENDING,
                             SIG_ALLOC_FIXED);

  g_sigpendingirqsignalalloc =
     sig_allocatependingsignalblock(&g_sigpendingirqsignal,
                             NUM_INT_SIGNALS_PENDING,
                             SIG_ALLOC_IRQ);
}
Exemple #2
0
static FAR sigactq_t *sig_allocateaction(void)
{
  FAR sigactq_t *sigact;

  /* Try to get the signal action structure from the free list */

  sigact = (FAR sigactq_t*)sq_remfirst(&g_sigfreeaction);

  /* Check if we got one. */

  if (!sigact)
    {
      /* Add another block of signal actions to the list */

      sig_allocateactionblock();

      /* And try again */

      sigact = (FAR sigactq_t*)sq_remfirst(&g_sigfreeaction);
      if (!sigact)
        {
          PANIC(OSERR_OUTOFMEMORY);
        }
  }

  return sigact;
}