pthread man page
时间:2009-07-05 来源:pz0513
转载自 http://www.9say.com/2009/02/pthread-manual/
为方便查找,将pthread的manual整理如下。
索引:
线程创建、退出:
- pthread_create
- pthread_exit
- pthread_atfork
- pthread_attr_destroy
- pthread_attr_getdetachstate
- pthread_attr_getinheritsched
- pthread_attr_getschedparam
- pthread_attr_getschedpolicy
- pthread_attr_getscope
- pthread_attr_init
- pthread_attr_setdetachstate
- pthread_attr_setinheritsched
- pthread_attr_setschedparam
- pthread_attr_setschedpolicy
- pthread_attr_setscope
- pthread_cancel
- pthread_cleanup_pop
- pthread_cleanup_pop_restore_np
- pthread_cleanup_push
- pthread_cleanup_push_defer_np
条件锁:
- pthread_cond_broadcast
- pthread_cond_destroy
- pthread_cond_init
- pthread_cond_signal
- pthread_cond_timedwait
- pthread_cond_wait
- pthread_condattr_destroy
- pthread_condattr_init
- pthread_detach
- pthread_equal
- pthread_getschedparam
- pthread_join
- pthread_key_create
- pthread_kill
- pthread_kill_other_threads_np
锁:
- pthread_mutex_destroy
- pthread_mutex_init
- pthread_mutex_lock
- pthread_mutex_trylock
- pthread_mutex_unlock
- pthread_mutexattr_destroy
- pthread_mutexattr_getkind_np
- pthread_mutexattr_init
- pthread_mutexattr_setkind_np
- pthread_once
- pthread_self
- pthread_setcancelstate
- pthread_setcanceltype
- pthread_setschedparam
- pthread_sigmask
- pthread_testcancel
信号操作:
- sem_init
- sem_wait
- sem_trywait
- sem_post
- sem_getvalue
- sem_destroy
PTHREAD_CREATE(3)
NAME
pthread_create – create a new thread
SYNOPSIS
#include <pthread.h>
int pthread_create(pthread_t * thread, pthread_attr_t * attr, void * (*start_routine)(void *), void * arg);
DESCRIPTION
pthread_create creates a new thread of control that executes concurrently with the calling thread. The new
thread applies the function start_routine passing it arg as first argument. The new thread terminates either
explicitly, by calling pthread_exit(3), or implicitly, by returning from the start_routine function. The latter
case is equivalent to calling pthread_exit(3) with the result returned by start_routine as exit code.
The attr argument specifies thread attributes to be applied to the new thread. See pthread_attr_init(3) for a
complete list of thread attributes. The attr argument can also be NULL, in which case default attributes are
used: the created thread is joinable (not detached) and has default (non real-time) scheduling policy.
RETURN VALUE
On success, the identifier of the newly created thread is stored in the location pointed by the thread argu-
ment, and a 0 is returned. On error, a non-zero error code is returned.
ERRORS
EAGAIN not enough system resources to create a process for the new thread.
EAGAIN more than PTHREAD_THREADS_MAX threads are already active.
AUTHOR
Xavier Leroy <[email protected]>
SEE ALSO
pthread_exit(3), pthread_join(3), pthread_detach(3), pthread_attr_init(3).