Back to index

glibc  2.9
Functions
pthread_cond_signal.c File Reference
#include <endian.h>
#include <errno.h>
#include <sysdep.h>
#include <lowlevellock.h>
#include <pthread.h>
#include <pthreadP.h>
#include <shlib-compat.h>
#include <kernel-features.h>

Go to the source code of this file.

Functions

int __pthread_cond_signal (pthread_cond_t *cond)
 versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal, GLIBC_2_3_2)

Function Documentation

Definition at line 32 of file pthread_cond_signal.c.

{
  int pshared = (cond->__data.__mutex == (void *) ~0l)
              ? LLL_SHARED : LLL_PRIVATE;

  /* Make sure we are alone.  */
  lll_lock (cond->__data.__lock, pshared);

  /* Are there any waiters to be woken?  */
  if (cond->__data.__total_seq > cond->__data.__wakeup_seq)
    {
      /* Yes.  Mark one of them as woken.  */
      ++cond->__data.__wakeup_seq;
      ++cond->__data.__futex;

      /* Wake one.  */
      if (! __builtin_expect (lll_futex_wake_unlock (&cond->__data.__futex, 1,
                                               1, &cond->__data.__lock,
                                               pshared), 0))
       return 0;

      lll_futex_wake (&cond->__data.__futex, 1, pshared);
    }

  /* We are done.  */
  lll_unlock (cond->__data.__lock, pshared);

  return 0;
}

Here is the call graph for this function:

versioned_symbol ( libpthread  ,
__pthread_cond_signal  ,
pthread_cond_signal  ,
GLIBC_2_3_2   
)