Пример #1
0
void apb_reference(FAR struct ap_buffer_s *apb)
{
  /* Do we need any thread protection here?  Almost certaily... */

  apb_semtake(apb);
  apb->crefs++;
  apb_semgive(apb);
}
Пример #2
0
void apb_free(FAR struct ap_buffer_s *apb)
{
  int   refcount;

  /* Perform a reference count decrement and possibly release the memory */

  apb_semtake(apb);
  refcount = apb->crefs--;
  apb_semgive(apb);

  if (refcount == 1)
    {
      auddbg("Freeing %p\n", apb);
      kufree(apb);
    }
}
Пример #3
0
void apb_free(FAR struct ap_buffer_s *apb)
{
  int refcount;

  /* Perform a reference count decrement and possibly release the memory */

  apb_semtake(apb);
  refcount = apb->crefs--;
  apb_semgive(apb);

  if (refcount <= 1)
    {
      audinfo("Freeing %p\n", apb);
      nxsem_destroy(&apb->sem);
      lib_ufree(apb);
    }
}