Back to index

glibc  2.9
Functions
sem_post.c File Reference
#include <errno.h>
#include <sysdep.h>
#include <lowlevellock.h>
#include <internaltypes.h>
#include <semaphore.h>
#include <shlib-compat.h>

Go to the source code of this file.

Functions

int __new_sem_post (sem_t *sem)
 versioned_symbol (libpthread, __new_sem_post, sem_post, GLIBC_2_1)

Function Documentation

int __new_sem_post ( sem_t sem)

Definition at line 30 of file sem_post.c.

{
  struct new_sem *isem = (struct new_sem *) sem;

  __asm __volatile (__lll_rel_instr ::: "memory");
  atomic_increment (&isem->value);
  __asm __volatile (__lll_acq_instr ::: "memory");
  if (isem->nwaiters > 0)
    {
      int err = lll_futex_wake (&isem->value, 1,
                            isem->private ^ FUTEX_PRIVATE_FLAG);
      if (__builtin_expect (err, 0) < 0)
       {
         __set_errno (-err);
         return -1;
       }
    }
  return 0;
}

Here is the call graph for this function:

versioned_symbol ( libpthread  ,
__new_sem_post  ,
sem_post  ,
GLIBC_2_1   
)