Back to index

glibc  2.9
Classes | Defines | Enumerations | Functions | Variables
pthread.h File Reference
#include <features.h>
#include <endian.h>
#include <sched.h>
#include <time.h>
#include <signal.h>
#include <bits/pthreadtypes.h>
#include <bits/setjmp.h>
#include <bits/wordsize.h>

Go to the source code of this file.

Classes

struct  _pthread_cleanup_buffer
struct  __pthread_unwind_buf_t
struct  __pthread_cleanup_frame
struct  __pthread_unwind_buf_t.__cancel_jmp_buf

Defines

#define __need_sigset_t
#define PTHREAD_CREATE_JOINABLE   PTHREAD_CREATE_JOINABLE
#define PTHREAD_CREATE_DETACHED   PTHREAD_CREATE_DETACHED
#define PTHREAD_MUTEX_INITIALIZER   { { 0, 0, 0, 0, 0, { 0 } } }
#define PTHREAD_INHERIT_SCHED   PTHREAD_INHERIT_SCHED
#define PTHREAD_EXPLICIT_SCHED   PTHREAD_EXPLICIT_SCHED
#define PTHREAD_SCOPE_SYSTEM   PTHREAD_SCOPE_SYSTEM
#define PTHREAD_SCOPE_PROCESS   PTHREAD_SCOPE_PROCESS
#define PTHREAD_PROCESS_PRIVATE   PTHREAD_PROCESS_PRIVATE
#define PTHREAD_PROCESS_SHARED   PTHREAD_PROCESS_SHARED
#define PTHREAD_COND_INITIALIZER   { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }
#define PTHREAD_CANCEL_ENABLE   PTHREAD_CANCEL_ENABLE
#define PTHREAD_CANCEL_DISABLE   PTHREAD_CANCEL_DISABLE
#define PTHREAD_CANCEL_DEFERRED   PTHREAD_CANCEL_DEFERRED
#define PTHREAD_CANCEL_ASYNCHRONOUS   PTHREAD_CANCEL_ASYNCHRONOUS
#define PTHREAD_CANCELED   ((void *) -1)
#define PTHREAD_ONCE_INIT   0
#define __cleanup_fct_attribute
#define pthread_cleanup_push(routine, arg)
#define pthread_cleanup_pop(execute)

Enumerations

enum  { PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_JOINABLE }
enum  { PTHREAD_MUTEX_TIMED_NP, PTHREAD_MUTEX_RECURSIVE_NP, PTHREAD_MUTEX_ERRORCHECK_NP, PTHREAD_MUTEX_ADAPTIVE_NP }
enum  { PTHREAD_INHERIT_SCHED, PTHREAD_INHERIT_SCHED }
enum  { PTHREAD_SCOPE_SYSTEM, PTHREAD_SCOPE_SYSTEM }
enum  { PTHREAD_PROCESS_PRIVATE, PTHREAD_PROCESS_PRIVATE }
enum  { PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_ENABLE }
enum  { PTHREAD_CANCEL_DEFERRED, PTHREAD_CANCEL_DEFERRED }

Functions

__BEGIN_DECLS int pthread_create (pthread_t *__restrict __newthread, __const pthread_attr_t *__restrict __attr, void *(*__start_routine)(void *), void *__restrict __arg) __THROW __nonnull((1
__BEGIN_DECLS int void pthread_exit (void *__retval) __attribute__((__noreturn__))
int pthread_join (pthread_t __th, void **__thread_return)
int pthread_detach (pthread_t __th) __THROW
pthread_t pthread_self (void) __THROW __attribute__((__const__))
int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW
int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull((1))
int pthread_attr_destroy (pthread_attr_t *__attr) __THROW __nonnull((1))
int pthread_attr_getdetachstate (__const pthread_attr_t *__attr, int *__detachstate) __THROW __nonnull((1
int int pthread_attr_setdetachstate (pthread_attr_t *__attr, int __detachstate) __THROW __nonnull((1))
int pthread_attr_getguardsize (__const pthread_attr_t *__attr, size_t *__guardsize) __THROW __nonnull((1
int int pthread_attr_setguardsize (pthread_attr_t *__attr, size_t __guardsize) __THROW __nonnull((1))
int pthread_attr_getschedparam (__const pthread_attr_t *__restrict __attr, struct sched_param *__restrict __param) __THROW __nonnull((1
int int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, __const struct sched_param *__restrict __param) __THROW __nonnull((1
int int int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict __attr, int *__restrict __policy) __THROW __nonnull((1
int int int int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) __THROW __nonnull((1))
int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict __attr, int *__restrict __inherit) __THROW __nonnull((1
int int pthread_attr_setinheritsched (pthread_attr_t *__attr, int __inherit) __THROW __nonnull((1))
int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr, int *__restrict __scope) __THROW __nonnull((1
int int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) __THROW __nonnull((1))
int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr) __THROW __nonnull((1
int pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr) __THROW __nonnull((1)) __attribute_deprecated__
int pthread_attr_getstacksize (__const pthread_attr_t *__restrict __attr, size_t *__restrict __stacksize) __THROW __nonnull((1
int int pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize) __THROW __nonnull((1))
int pthread_setschedparam (pthread_t __target_thread, int __policy, __const struct sched_param *__param) __THROW __nonnull((3))
int pthread_getschedparam (pthread_t __target_thread, int *__restrict __policy, struct sched_param *__restrict __param) __THROW __nonnull((2
int int pthread_setschedprio (pthread_t __target_thread, int __prio) __THROW
int pthread_once (pthread_once_t *__once_control, void(*__init_routine)(void)) __nonnull((1
int int pthread_setcancelstate (int __state, int *__oldstate)
int pthread_setcanceltype (int __type, int *__oldtype)
int pthread_cancel (pthread_t __th)
void pthread_testcancel (void)
void __pthread_register_cancel (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute
void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute
void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute __attribute__((__noreturn__)) __attribute__((__weak__))
int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW
int pthread_mutex_init (pthread_mutex_t *__mutex, __const pthread_mutexattr_t *__mutexattr) __THROW __nonnull((1))
int pthread_mutex_destroy (pthread_mutex_t *__mutex) __THROW __nonnull((1))
int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROW __nonnull((1))
int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROW __nonnull((1))
int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW __nonnull((1))
int pthread_mutexattr_init (pthread_mutexattr_t *__attr) __THROW __nonnull((1))
int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) __THROW __nonnull((1))
int pthread_mutexattr_getpshared (__const pthread_mutexattr_t *__restrict __attr, int *__restrict __pshared) __THROW __nonnull((1
int int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, int __pshared) __THROW __nonnull((1))
int pthread_cond_init (pthread_cond_t *__restrict __cond, __const pthread_condattr_t *__restrict __cond_attr) __THROW __nonnull((1))
int pthread_cond_destroy (pthread_cond_t *__cond) __THROW __nonnull((1))
int pthread_cond_signal (pthread_cond_t *__cond) __THROW __nonnull((1))
int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW __nonnull((1))
int pthread_cond_wait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex) __nonnull((1
int int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, __const struct timespec *__restrict __abstime) __nonnull((1
int int int pthread_condattr_init (pthread_condattr_t *__attr) __THROW __nonnull((1))
int pthread_condattr_destroy (pthread_condattr_t *__attr) __THROW __nonnull((1))
int pthread_condattr_getpshared (__const pthread_condattr_t *__restrict __attr, int *__restrict __pshared) __THROW __nonnull((1
int int pthread_condattr_setpshared (pthread_condattr_t *__attr, int __pshared) __THROW __nonnull((1))
int pthread_key_create (pthread_key_t *__key, void(*__destr_function)(void *)) __THROW __nonnull((1))
int pthread_key_delete (pthread_key_t __key) __THROW
void * pthread_getspecific (pthread_key_t __key) __THROW
int pthread_setspecific (pthread_key_t __key, __const void *__pointer) __THROW
int pthread_atfork (void(*__prepare)(void), void(*__parent)(void), void(*__child)(void)) __THROW

Variables

int __attribute_deprecated__

Class Documentation

struct __pthread_unwind_buf_t

Definition at line 495 of file pthread.h.

Class Members
struct __pthread_unwind_buf_t __cancel_jmp_buf
void * __pad
struct __pthread_unwind_buf_t.__cancel_jmp_buf

Definition at line 497 of file pthread.h.

Class Members
__jmp_buf __cancel_jmp_buf
int __mask_was_saved

Define Documentation

Definition at line 507 of file pthread.h.

#define __need_sigset_t

Definition at line 28 of file pthread.h.

Definition at line 203 of file pthread.h.

Definition at line 201 of file pthread.h.

Definition at line 196 of file pthread.h.

Definition at line 194 of file pthread.h.

#define PTHREAD_CANCELED   ((void *) -1)

Definition at line 205 of file pthread.h.

#define pthread_cleanup_pop (   execute)
Value:
do; while (0); /* Empty to allow label before pthread_cleanup_pop.  */  \
    } while (0);                                                     \
    __pthread_unregister_cancel (&__cancel_buf);                     \
    if (execute)                                                     \
      __cancel_routine (__cancel_arg);                                      \
  } while (0)

Definition at line 657 of file pthread.h.

#define pthread_cleanup_push (   routine,
  arg 
)
Value:
do {                                                                 \
    __pthread_unwind_buf_t __cancel_buf;                             \
    void (*__cancel_routine) (void *) = (routine);                          \
    void *__cancel_arg = (arg);                                             \
    int not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *)            \
                                  __cancel_buf.__cancel_jmp_buf, 0);      \
    if (__builtin_expect (not_first_call, 0))                               \
      {                                                                     \
       __cancel_routine (__cancel_arg);                              \
       __pthread_unwind_next (&__cancel_buf);                               \
       /* NOTREACHED */                                              \
      }                                                                     \
									      \
    __pthread_register_cancel (&__cancel_buf);                              \
    do {

Definition at line 636 of file pthread.h.

#define PTHREAD_COND_INITIALIZER   { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }

Definition at line 178 of file pthread.h.

Definition at line 41 of file pthread.h.

Definition at line 39 of file pthread.h.

Definition at line 152 of file pthread.h.

Definition at line 150 of file pthread.h.

#define PTHREAD_MUTEX_INITIALIZER   { { 0, 0, 0, 0, 0, { 0 } } }

Definition at line 100 of file pthread.h.

#define PTHREAD_ONCE_INIT   0

Definition at line 209 of file pthread.h.

Definition at line 170 of file pthread.h.

Definition at line 172 of file pthread.h.

Definition at line 162 of file pthread.h.

Definition at line 160 of file pthread.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
PTHREAD_CREATE_JOINABLE 
PTHREAD_CREATE_JOINABLE 

Definition at line 36 of file pthread.h.

{
  PTHREAD_CREATE_JOINABLE,
#define PTHREAD_CREATE_JOINABLE    PTHREAD_CREATE_JOINABLE
  PTHREAD_CREATE_DETACHED
#define PTHREAD_CREATE_DETACHED    PTHREAD_CREATE_DETACHED
};
anonymous enum
Enumerator:
PTHREAD_MUTEX_TIMED_NP 
PTHREAD_MUTEX_RECURSIVE_NP 
PTHREAD_MUTEX_ERRORCHECK_NP 
PTHREAD_MUTEX_ADAPTIVE_NP 

Definition at line 46 of file pthread.h.

{
  PTHREAD_MUTEX_TIMED_NP,
  PTHREAD_MUTEX_RECURSIVE_NP,
  PTHREAD_MUTEX_ERRORCHECK_NP,
  PTHREAD_MUTEX_ADAPTIVE_NP
#ifdef __USE_UNIX98
  ,
  PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
  PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
  PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
#endif
#ifdef __USE_GNU
  /* For compatibility.  */
  , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP
#endif
};
anonymous enum
Enumerator:
PTHREAD_INHERIT_SCHED 
PTHREAD_INHERIT_SCHED 

Definition at line 147 of file pthread.h.

{
  PTHREAD_INHERIT_SCHED,
#define PTHREAD_INHERIT_SCHED   PTHREAD_INHERIT_SCHED
  PTHREAD_EXPLICIT_SCHED
#define PTHREAD_EXPLICIT_SCHED  PTHREAD_EXPLICIT_SCHED
};
anonymous enum
Enumerator:
PTHREAD_SCOPE_SYSTEM 
PTHREAD_SCOPE_SYSTEM 

Definition at line 157 of file pthread.h.

{
  PTHREAD_SCOPE_SYSTEM,
#define PTHREAD_SCOPE_SYSTEM    PTHREAD_SCOPE_SYSTEM
  PTHREAD_SCOPE_PROCESS
#define PTHREAD_SCOPE_PROCESS   PTHREAD_SCOPE_PROCESS
};
anonymous enum
Enumerator:
PTHREAD_PROCESS_PRIVATE 
PTHREAD_PROCESS_PRIVATE 

Definition at line 167 of file pthread.h.

{
  PTHREAD_PROCESS_PRIVATE,
#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
  PTHREAD_PROCESS_SHARED
#define PTHREAD_PROCESS_SHARED  PTHREAD_PROCESS_SHARED
};
anonymous enum
Enumerator:
PTHREAD_CANCEL_ENABLE 
PTHREAD_CANCEL_ENABLE 

Definition at line 191 of file pthread.h.

{
  PTHREAD_CANCEL_ENABLE,
#define PTHREAD_CANCEL_ENABLE   PTHREAD_CANCEL_ENABLE
  PTHREAD_CANCEL_DISABLE
#define PTHREAD_CANCEL_DISABLE  PTHREAD_CANCEL_DISABLE
};
anonymous enum
Enumerator:
PTHREAD_CANCEL_DEFERRED 
PTHREAD_CANCEL_DEFERRED 

Definition at line 198 of file pthread.h.

{
  PTHREAD_CANCEL_DEFERRED,
#define PTHREAD_CANCEL_DEFERRED    PTHREAD_CANCEL_DEFERRED
  PTHREAD_CANCEL_ASYNCHRONOUS
#define PTHREAD_CANCEL_ASYNCHRONOUS       PTHREAD_CANCEL_ASYNCHRONOUS
};

Function Documentation

Definition at line 26 of file cleanup.c.

{
  struct pthread_unwind_buf *ibuf = (struct pthread_unwind_buf *) buf;
  struct pthread *self = THREAD_SELF;

  /* Store old info.  */
  ibuf->priv.data.prev = THREAD_GETMEM (self, cleanup_jmp_buf);
  ibuf->priv.data.cleanup = THREAD_GETMEM (self, cleanup);

  /* Store the new cleanup handler info.  */
  THREAD_SETMEM (self, cleanup_jmp_buf, (struct pthread_unwind_buf *) buf);
}
int __sigsetjmp ( struct __jmp_buf_tag __env,
int  __savemask 
)

Here is the caller graph for this function:

int pthread_atfork ( void(*)(void)  __prepare,
void(*)(void)  __parent,
void(*)(void)  __child 
)
int pthread_attr_getdetachstate ( __const pthread_attr_t __attr,
int __detachstate 
)

Here is the caller graph for this function:

int pthread_attr_getguardsize ( __const pthread_attr_t __attr,
size_t __guardsize 
)

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

int int pthread_attr_setdetachstate ( pthread_attr_t __attr,
int  __detachstate 
)
int int pthread_attr_setguardsize ( pthread_attr_t __attr,
size_t  __guardsize 
)

Definition at line 25 of file pthread_attr_setguardsize.c.

{
  struct pthread_attr *iattr;

  assert (sizeof (*attr) >= sizeof (struct pthread_attr));
  iattr = (struct pthread_attr *) attr;

  /* Note that we don't round the value here.  The standard requires
     that subsequent pthread_attr_getguardsize calls return the value
     set by the user.  */
  iattr->guardsize = guardsize;

  return 0;
}

Here is the caller graph for this function:

int int pthread_attr_setinheritsched ( pthread_attr_t __attr,
int  __inherit 
)

Here is the caller graph for this function:

int int pthread_attr_setscope ( pthread_attr_t __attr,
int  __scope 
)
int pthread_attr_setstackaddr ( pthread_attr_t __attr,
void *  __stackaddr 
)
int int pthread_attr_setstacksize ( pthread_attr_t __attr,
size_t  __stacksize 
)

Definition at line 89 of file cancel.c.

{
  pthread_handle handle = thread_handle(thread);
  int pid;
  int dorestart = 0;
  pthread_descr th;
  pthread_extricate_if *pextricate;
  int already_canceled;

  __pthread_lock(&handle->h_lock, NULL);
  if (invalid_handle(handle, thread)) {
    __pthread_unlock(&handle->h_lock);
    return ESRCH;
  }

  th = handle->h_descr;

  already_canceled = th->p_canceled;
  th->p_canceled = 1;

  if (th->p_cancelstate == PTHREAD_CANCEL_DISABLE || already_canceled) {
    __pthread_unlock(&handle->h_lock);
    return 0;
  }

  pextricate = th->p_extricate;
  pid = th->p_pid;

  /* If the thread has registered an extrication interface, then
     invoke the interface. If it returns 1, then we succeeded in
     dequeuing the thread from whatever waiting object it was enqueued
     with. In that case, it is our responsibility to wake it up.
     And also to set the p_woken_by_cancel flag so the woken thread
     can tell that it was woken by cancellation. */

  if (pextricate != NULL) {
    dorestart = pextricate->pu_extricate_func(pextricate->pu_object, th);
    th->p_woken_by_cancel = dorestart;
  }

  __pthread_unlock(&handle->h_lock);

  /* If the thread has suspended or is about to, then we unblock it by
     issuing a restart, instead of a cancel signal. Otherwise we send
     the cancel signal to unblock the thread from a cancellation point,
     or to initiate asynchronous cancellation. The restart is needed so
     we have proper accounting of restarts; suspend decrements the thread's
     resume count, and restart() increments it.  This also means that suspend's
     handling of the cancel signal is obsolete. */

  if (dorestart)
    restart(th);
  else
    kill(pid, __pthread_sig_cancel);

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

int int pthread_condattr_setpshared ( pthread_condattr_t __attr,
int  __pshared 
)

Definition at line 331 of file condvar.c.

{
  if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED)
    return EINVAL;

  /* For now it is not possible to shared a conditional variable.  */
  if (pshared != PTHREAD_PROCESS_PRIVATE)
    return ENOSYS;

  return 0;
}

Here is the caller graph for this function:

__BEGIN_DECLS int pthread_create ( pthread_t *__restrict  __newthread,
__const pthread_attr_t *__restrict  __attr,
void *(*)(void *)  __start_routine,
void *__restrict  __arg 
)

Here is the caller graph for this function:

Definition at line 184 of file join.c.

{
  int terminated;
  struct pthread_request request;
  pthread_handle handle = thread_handle(thread_id);
  pthread_descr th;

  __pthread_lock(&handle->h_lock, NULL);
  if (nonexisting_handle(handle, thread_id)) {
    __pthread_unlock(&handle->h_lock);
    return ESRCH;
  }
  th = handle->h_descr;
  /* If already detached, error */
  if (th->p_detached) {
    __pthread_unlock(&handle->h_lock);
    return EINVAL;
  }
  /* If already joining, don't do anything. */
  if (th->p_joining != NULL) {
    __pthread_unlock(&handle->h_lock);
    return 0;
  }
  /* Mark as detached */
  th->p_detached = 1;
  terminated = th->p_terminated;
  __pthread_unlock(&handle->h_lock);
  /* If already terminated, notify thread manager to reclaim resources */
  if (terminated && __pthread_manager_request >= 0) {
    request.req_thread = thread_self();
    request.req_kind = REQ_FREE;
    request.req_args.free.thread_id = thread_id;
    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
                                   (char *) &request, sizeof(request)));
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int pthread_equal ( pthread_t  __thread1,
pthread_t  __thread2 
)
__BEGIN_DECLS int void pthread_exit ( void *  __retval)
int pthread_getschedparam ( pthread_t  __target_thread,
int *__restrict  __policy,
struct sched_param *__restrict  __param 
)

Here is the caller graph for this function:

int pthread_join ( pthread_t  __th,
void **  __thread_return 
)

Definition at line 114 of file join.c.

{
  volatile pthread_descr self = thread_self();
  struct pthread_request request;
  pthread_handle handle = thread_handle(thread_id);
  pthread_descr th;
  pthread_extricate_if extr;
  int already_canceled = 0;

  /* Set up extrication interface */
  extr.pu_object = handle;
  extr.pu_extricate_func = join_extricate_func;

  __pthread_lock(&handle->h_lock, self);
  if (nonexisting_handle(handle, thread_id)) {
    __pthread_unlock(&handle->h_lock);
    return ESRCH;
  }
  th = handle->h_descr;
  if (th == self) {
    __pthread_unlock(&handle->h_lock);
    return EDEADLK;
  }
  /* If detached or already joined, error */
  if (th->p_detached || th->p_joining != NULL) {
    __pthread_unlock(&handle->h_lock);
    return EINVAL;
  }
  /* If not terminated yet, suspend ourselves. */
  if (! th->p_terminated) {
    /* Register extrication interface */
    __pthread_set_own_extricate_if(self, &extr);
    if (!(THREAD_GETMEM(self, p_canceled)
       && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE))
      th->p_joining = self;
    else
      already_canceled = 1;
    __pthread_unlock(&handle->h_lock);

    if (already_canceled) {
      __pthread_set_own_extricate_if(self, 0);
      __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
    }

    suspend(self);
    /* Deregister extrication interface */
    __pthread_set_own_extricate_if(self, 0);

    /* This is a cancellation point */
    if (THREAD_GETMEM(self, p_woken_by_cancel)
       && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) {
      THREAD_SETMEM(self, p_woken_by_cancel, 0);
      __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
    }
    __pthread_lock(&handle->h_lock, self);
  }
  /* Get return value */
  if (thread_return != NULL) *thread_return = th->p_retval;
  __pthread_unlock(&handle->h_lock);
  /* Send notification to thread manager */
  if (__pthread_manager_request >= 0) {
    request.req_thread = self;
    request.req_kind = REQ_FREE;
    request.req_args.free.thread_id = thread_id;
    TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
                                   (char *) &request, sizeof(request)));
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int pthread_key_create ( pthread_key_t __key,
void(*)(void *)  __destr_function 
)

Definition at line 91 of file specific.c.

{
  pthread_descr self = thread_self();

  pthread_mutex_lock(&pthread_keys_mutex);
  if (key >= PTHREAD_KEYS_MAX || !pthread_keys[key].in_use) {
    pthread_mutex_unlock(&pthread_keys_mutex);
    return EINVAL;
  }
  pthread_keys[key].in_use = 0;
  pthread_keys[key].destr = NULL;

  /* Set the value of the key to NULL in all running threads, so
     that if the key is reallocated later by pthread_key_create, its
     associated values will be NULL in all threads.

     If no threads have been created yet, or if we are exiting, clear
     it just in the current thread.  */

  struct pthread_key_delete_helper_args args;
  args.idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE;
  args.idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE;
  if (__pthread_manager_request != -1
      && !(__builtin_expect (__pthread_exit_requested, 0)))
    {
      struct pthread_request request;

      args.self = 0;

      request.req_thread = self;
      request.req_kind = REQ_FOR_EACH_THREAD;
      request.req_args.for_each.arg = &args;
      request.req_args.for_each.fn = pthread_key_delete_helper;

      TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
                                     (char *) &request, sizeof(request)));
      suspend(self);
    }
  else
    {
      if (self->p_specific[args.idx1st] != NULL)
       self->p_specific[args.idx1st][args.idx2nd] = NULL;
    }

  pthread_mutex_unlock(&pthread_keys_mutex);
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 25 of file pthread_mutexattr_setpshared.c.

{
  struct pthread_mutexattr *iattr;

  if (pshared != PTHREAD_PROCESS_PRIVATE
      && __builtin_expect (pshared != PTHREAD_PROCESS_SHARED, 0))
    return EINVAL;

  iattr = (struct pthread_mutexattr *) attr;

  if (pshared == PTHREAD_PROCESS_PRIVATE)
    iattr->mutexkind &= ~PTHREAD_MUTEXATTR_FLAG_PSHARED;
  else
    iattr->mutexkind |= PTHREAD_MUTEXATTR_FLAG_PSHARED;

  return 0;
}
int pthread_once ( pthread_once_t __once_control,
void(*)(void)  __init_routine 
)

Here is the caller graph for this function:

pthread_t pthread_self ( void  ) const
int int pthread_setcancelstate ( int  __state,
int __oldstate 
)
int pthread_setcanceltype ( int  __type,
int __oldtype 
)
int pthread_setschedparam ( pthread_t  __target_thread,
int  __policy,
__const struct sched_param __param 
)
int int pthread_setschedprio ( pthread_t  __target_thread,
int  __prio 
)

Definition at line 29 of file pthread_setschedprio.c.

{
  struct pthread *pd = (struct pthread *) threadid;

  /* Make sure the descriptor is valid.  */
  if (INVALID_TD_P (pd))
    /* Not a valid thread handle.  */
    return ESRCH;

  int result = 0;
  struct sched_param param;
  param.sched_priority = prio;

  lll_lock (pd->lock, LLL_PRIVATE);

  /* If the thread should have higher priority because of some
     PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority.  */
  if (__builtin_expect (pd->tpp != NULL, 0) && pd->tpp->priomax > prio)
    param.sched_priority = pd->tpp->priomax;

  /* Try to set the scheduler information.  */
  if (__builtin_expect (sched_setparam (pd->tid, &param) == -1, 0))
    result = errno;
  else
    {
      /* We succeeded changing the kernel information.  Reflect this
        change in the thread descriptor.  */
      param.sched_priority = prio;
      memcpy (&pd->schedparam, &param, sizeof (struct sched_param));
      pd->flags |= ATTR_FLAG_SCHED_SET;
    }

  lll_unlock (pd->lock, LLL_PRIVATE);

  return result;
}

Here is the call graph for this function:

int pthread_setspecific ( pthread_key_t  __key,
__const void *  __pointer 
)
void pthread_testcancel ( void  )

Definition at line 147 of file cancel.c.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 349 of file pthread.h.