Back to index

glibc  2.9
Functions
sem_trywait.c File Reference
#include <errno.h>
#include <sysdep.h>
#include <lowlevellock.h>
#include <internaltypes.h>
#include <semaphore.h>
#include <shlib-compat.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int __new_sem_trywait (sem_t *sem)
 versioned_symbol (libpthread, __new_sem_trywait, sem_trywait, GLIBC_2_1)

Function Documentation

Definition at line 31 of file sem_trywait.c.

{
  int *futex = (int *) sem;
  int val;

  if (*futex > 0)
    {
      val = atomic_decrement_if_positive (futex);
      if (val > 0)
       return 0;
    }

  __set_errno (EAGAIN);
  return -1;
}
versioned_symbol ( libpthread  ,
__new_sem_trywait  ,
sem_trywait  ,
GLIBC_2_1   
)