Samsung Internal API reference  2.0
pthread.h File Reference

POSIX compatible thread library. More...

Go to the source code of this file.

Data Structures

struct  __pthread_once_t
 
struct  __pthread_attr_t
 
struct  __pthread_mutex_t
 
struct  __pthread_cond_t
 
struct  __pthread_condattr_t
 

Macros

#define PTHREAD_STACK_MIN   (PAGE_SIZE)
 
#define PTHREAD_GUARD_MIN   (PAGE_SIZE)
 
#define PTHREAD_GUARD_MAX   (PAGE_SIZE << 2)
 
#define MUTEX_STATE_UNLOCKED   0
 
#define MUTEX_STATE_LOCKED   1
 
#define PTHREAD_MUTEX_INITIALIZER   { { MUTEX_STATE_UNLOCKED }, PTHREAD_MUTEX_DEFAULT, 0, 0 }
 
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP   { { MUTEX_STATE_UNLOCKED }, PTHREAD_MUTEX_ERRORCHECK, 0, 0 }
 
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP   { { MUTEX_STATE_UNLOCKED }, PTHREAD_MUTEX_RECURSIVE, 0, 0 }
 
#define PTHREAD_ONCE_INIT   { ATOMIC_INITIALIZER }
 
#define PTHREAD_COND_INITIALIZER   { ATOMIC_INITIALIZER }
 Object for static initialization of pthread_cond_t variables.
 
#define pthread_sigmask(how, set, oldset)   sigprocmask(how, set, oldset)
 Set signal mask for specified thread. More...
 

Typedefs

typedef struct pthread_impl pthread_impl_t
 
typedef uintptr_t pthread_t
 
typedef uint32_t pthread_mutexattr_t
 
typedef struct __pthread_mutex_t pthread_mutex_t
 
typedef unsigned pthread_key_t
 
typedef struct __pthread_attr_t pthread_attr_t
 
typedef struct __pthread_once_t pthread_once_t
 
typedef struct __pthread_cond_t pthread_cond_t
 
typedef struct __pthread_cond_t pthread_condattr_t
 

Enumerations

enum  {
  PTHREAD_MUTEX_NORMAL = 0, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL,
  PTHREAD_MUTEX_DESTROYED = -1, PTHREAD_MUTEX_ERRORCHECK_NP = PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE_NP = PTHREAD_MUTEX_RECURSIVE
}
 types and states for mutex More...
 
enum  { PTHREAD_CREATE_JOINABLE, PTHREAD_CREATE_DETACHED }
 detach state attribute settings More...
 

Functions

int pthread_attr_init (pthread_attr_t *attr)
 The pthread_attr_init() function initialize attribute struct. More...
 
int pthread_attr_destroy (pthread_attr_t *attr)
 The pthread_attr_destroy() function destroy attribute struct. More...
 
int pthread_attr_getstacksize (const pthread_attr_t *attr, size_t *stacksize)
 The pthread_attr_getstacksize() function gets size of stack. More...
 
int pthread_attr_getguardsize (const pthread_attr_t *attr, size_t *guardsize)
 The pthread_attr_getguardsize() function gets size of guard. More...
 
int pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize)
 The pthread_attr_setstacksize() function sets size of stack. More...
 
int pthread_attr_setguardsize (pthread_attr_t *attr, size_t guardsize)
 The pthread_attr_setguardsize() function sets size of guard. More...
 
int pthread_attr_getstackaddr (const pthread_attr_t *attr, void **stackaddr)
 The pthread_attr_getstackaddr() function gets stack address. More...
 
int pthread_attr_setstackaddr (pthread_attr_t *attr, void *stackaddr)
 The pthread_attr_setstackaddr() function gets stack address. More...
 
int pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr, size_t *stacksize)
 The pthread_attr_getstack() function gets stack address and size. More...
 
int pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, size_t stacksize)
 The pthread_attr_setstack() function sets stack address and size. More...
 
int pthread_create (pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
 The pthread_create() function starts a new thread in the calling process. The new thread starts execution by invoking start_routine() arg is passed as the sole argument of start_routine(). More...
 
_noreturn_ void pthread_exit (void *retval)
 Terminate calling thread. More...
 
int pthread_join (pthread_t thread, void **retval)
 Wait for the thread specified by thread to terminate. If that thread has already terminated, then returns immediately. The thread specified by thread must be joinable. More...
 
int pthread_once (pthread_once_t *once_control, void(*init_routine)(void))
 If any thread in a process with a once_control parameter makes a call to pthread_once(), the first call will summon the init_routine(), but subsequent calls will not. The once_control parameter determines whether the associated initialization routine has been called. The init_routine() is complete upon return of pthread_once(). More...
 
void * pthread_getspecific (pthread_key_t key)
 Return the value currently bound to the specified key on behalf of the calling thread. More...
 
int pthread_setspecific (pthread_key_t key, const void *value)
 Associate a thread-specific value with a key obtained via a previous call to pthread_key_create(). More...
 
int pthread_key_create (pthread_key_t *key, void(*destructor)(void *))
 Create data key for data manipulation functions (pthread_getspecific(), pthread_setspecific()). Multiple threads can call data manipulation functions with the same key. In this case all threads will have separate data. More...
 
int pthread_key_delete (pthread_key_t key)
 Delete data key and destructor associated with key. After key deletion there is no destructor will be called on thread exits. More...
 
int pthread_mutexattr_init (pthread_mutexattr_t *attr)
 Initialize mutex attributes object and initialize attributes with default values. More...
 
int pthread_mutexattr_destroy (pthread_mutexattr_t *attr)
 Destroy attributes object and make all attribute values are uninitialized. More...
 
int pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *type)
 Get mutex type attribute associated with attr parameter. More...
 
int pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type)
 Set mutex type attribute associated with attr parameter. More...
 
int pthread_mutex_lock (pthread_mutex_t *mutex)
 Lock mutex or wait while another thread is unlock currently locked mutex. More...
 
int pthread_mutex_trylock (pthread_mutex_t *mutex)
 Lock mutex or fail if mutex is already locked. More...
 
int pthread_mutex_unlock (pthread_mutex_t *mutex)
 Release lock on currently locked mutex. More...
 
int pthread_mutex_destroy (pthread_mutex_t *mutex)
 Destroy mutex object and make all associated data are uninitialized. More...
 
int pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
 Initialize mutex object mutex with attributes given by attr parameter. If attr parameter is NULL then default attributes will be used. More...
 
int pthread_cond_destroy (pthread_cond_t *cond)
 Destroy conditional variable object and make it unitialized. More...
 
int pthread_condattr_init (pthread_condattr_t *attr)
 Initialize conditional variable attributes with default values. More...
 
int pthread_condattr_destroy (pthread_condattr_t *attr)
 Destroy conditional variable attributes. More...
 
int pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr)
 Initialize conditional variable object cond with attributes given by attr parameter. More...
 
int pthread_cond_signal (pthread_cond_t *cond)
 Unblock at least one of the threads that are blocked on the specified condition variable cond (if any threads are blocked on cond). More...
 
int pthread_cond_broadcast (pthread_cond_t *cond)
 Wake up all threads locked by conditional variable cond. More...
 
int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
 Block on condition variable cond, while another thread will unblock this variable by pthread_cond_broadcast() / pthread_cond_signal() call. More...
 
int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *timeout)
 Block on condition variable cond, while another thread will unblock this variable by pthread_cond_broadcast() / pthread_cond_signal() call. If timeout reached before condition set then wait will be interrupted and error is returned. More...
 
pthread_t pthread_self (void)
 Obtain ID of the calling thread. More...
 
int pthread_kill (pthread_t thread, int sig)
 Send signal to specified thread. More...
 
int pthread_equal (pthread_t t1, pthread_t t2)
 Compare thread IDs. More...
 
int pthread_detach (pthread_t thread)
 Detach a thread. More...
 
int pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate)
 Set the detach state attribute. More...
 
int pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstate)
 Get the detach state attribute. More...
 
int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
 Get attributes of created thread. More...
 

Detailed Description

POSIX compatible thread library.