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>

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.

{
  struct sparc_old_sem *isem = (struct sparc_old_sem *) sem;
  int val;

  if (isem->value > 0)
    {
      if (__atomic_is_v9)
       val = atomic_decrement_if_positive (&isem->value);
      else
       {
         __sparc32_atomic_do_lock24 (&isem->lock);
         val = isem->value;
         if (val > 0)
           isem->value = val - 1;
         __sparc32_atomic_do_unlock24 (&isem->lock);
       }
      if (val > 0)
       return 0;
    }

  __set_errno (EAGAIN);
  return -1;
}

Here is the call graph for this function:

versioned_symbol ( libpthread  ,
__new_sem_trywait  ,
sem_trywait  ,
GLIBC_2_1   
)