⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pthread.h

📁 GNU Hurd 源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
   *PSHARED.  */extern int pthread_condattr_getpshared (const pthread_condattr_t *attr,					int *pshared);/* Set the value of the process shared attribute in *ATTR to   PSHARED.  */extern int pthread_condattr_setpshared (pthread_condattr_t *attr,					int pshared);/* Condition variables.  */#include <bits/condition.h>typedef struct __pthread_cond pthread_cond_t;#define PTHREAD_COND_INITIALIZER __PTHREAD_COND_INITIALIZERextern int pthread_cond_init (pthread_cond_t *cond,			      const pthread_condattr_t *attr);extern int pthread_cond_destroy (pthread_cond_t *cond);/* Unblock at least one of the threads that are blocked on condition   variable COND.  */extern int pthread_cond_signal (pthread_cond_t *__cond);/* Unblock all threads that are blocked on condition variable COND.  */extern int pthread_cond_broadcast (pthread_cond_t *__cond);/* Block on condition variable COND.  MUTEX should be held by the   calling thread.  On success, MUTEX will be held by the calling   thread.  */extern int pthread_cond_wait (pthread_cond_t *__cond,			      pthread_mutex_t *__mutex);/* Block on condition variable COND.  MUTEX should be held by the   calling thread. On success, MUTEX will be held by the calling   thread.  If the time specified by ABSTIME passes, ETIMEDOUT is   returned, and MUTEX will nevertheless be held.  */extern int pthread_cond_timedwait (pthread_cond_t *__cond,				   pthread_mutex_t *__mutex,				   __const struct timespec *__abstime);/* Spin locks.  */#ifdef __USE_XOPEN2K# include <bits/spin-lock.h>typedef __pthread_spinlock_t pthread_spinlock_t;#define PTHREAD_SPINLOCK_INITIALIZER __SPIN_LOCK_INITIALIZER/* Destroy the spin lock object LOCK.  */extern int pthread_spin_destroy (pthread_spinlock_t *__lock);/* Initialize the spin lock object LOCK.  PSHARED determines whether   the spin lock can be operated upon by multiple processes.  */extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared);/* Lock the spin lock object LOCK.  If the lock is held by another   thread spin until it becomes available.  */extern int pthread_spin_lock (pthread_spinlock_t *__lock);/* Lock the spin lock object LOCK.  Fail if the lock is held by   another thread.  */extern int pthread_spin_trylock (pthread_spinlock_t *__lock);/* Unlock the spin lock object LOCK.  */extern int pthread_spin_unlock (pthread_spinlock_t *__lock);# ifdef __USE_EXTERN_INLINESextern __inline intpthread_spin_destroy (pthread_spinlock_t *__lock){  return __pthread_spin_destroy (__lock);}extern __inline intpthread_spin_init (pthread_spinlock_t *__lock, int __pshared){  return __pthread_spin_init (__lock, __pshared);}extern __inline intpthread_spin_lock (pthread_spinlock_t *__lock){  return __pthread_spin_lock (__lock);}extern __inline intpthread_spin_trylock (pthread_spinlock_t *__lock){  return __pthread_spin_trylock (__lock);}extern __inline intpthread_spin_unlock (pthread_spinlock_t *__lock){  return __pthread_spin_unlock (__lock);}# endif /* Use extern inlines.  */#endif /* XPG6.  *//* rwlock attributes.  */#include <bits/rwlock-attr.h>typedef struct __pthread_rwlockattr pthread_rwlockattr_t;/* Initialize rwlock attribute object in *ATTR to the default   values.  */extern int pthread_rwlockattr_init (pthread_rwlockattr_t *attr);/* Destroy the rwlock attribute object in *ATTR.  */extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr);/* Return the value of the process shared attribute in *ATTR in   *PSHARED.  */extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *attr,					  int *pshared);/* Set the value of the process shared atrribute in *ATTR to   PSHARED.  */extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr,					  int pshared);/* rwlocks.  */#include <bits/rwlock.h>typedef struct __pthread_rwlock pthread_rwlock_t;/* Create a rwlock object with attributes given by ATTR and strore the   result in *RWLOCK.  */extern int pthread_rwlock_init (pthread_rwlock_t *rwlock,				const pthread_rwlockattr_t *attr);/* Destroy the rwlock *RWLOCK.  */extern int pthread_rwlock_destroy (pthread_rwlock_t *rwlock);/* Acquire the rwlock *RWLOCK for reading.  */extern int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock);/* Acquire the rwlock *RWLOCK for reading.  */extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock);/* Acquire the rwlock *RWLOCK for reading blocking until *ABSTIME if   it is already held.  */extern int pthread_rwlock_timedrdlock (struct __pthread_rwlock *rwlock,				       const struct timespec *abstime);/* Acquire the rwlock *RWLOCK for writing.  */extern int pthread_rwlock_wrlock (pthread_rwlock_t *rwlock);/* Try to acquire the rwlock *RWLOCK for writing.  */extern int pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock);/* Acquire the rwlock *RWLOCK for writing blocking until *ABSTIME if   it is already held.  */extern int pthread_rwlock_timedwrlock (struct __pthread_rwlock *rwlock,				       const struct timespec *abstime);/* Release the lock held by the current thread on *RWLOCK.  */extern int pthread_rwlock_unlock (pthread_rwlock_t *rwlock);/* Cancelation.  *//* Register a cleanup handler.  */extern void pthread_cleanup_push (void (*routine) (void *), void *arg);/* Unregister a cleanup handler.  */extern void pthread_cleanup_pop (int execute);#include <bits/cancelation.h>#define PTHREAD_CANCEL_DISABLE 0#define PTHREAD_CANCEL_ENABLE 1/* Return the calling thread's cancelation state in *OLDSTATE and set   its state to STATE.  */extern int pthread_setcancelstate (int state, int *oldstate);#define PTHREAD_CANCEL_DEFERRED 0#define PTHREAD_CANCEL_ASYNCHRONOUS 1/* Return the calling thread's cancelation type in *OLDTYPE and set   its type to TYPE.  */extern int pthread_setcanceltype (int type, int *oldtype);/* Value returned by pthread_join if the target thread was   canceled.  */#define PTHREAD_CANCELED ((void *) -1)/* Cancel THEAD.  */extern int pthread_cancel (pthread_t thread);/* Add an explicit cancelation point.  */extern void pthread_testcancel (void);/* Barriers attributes.  */#include <bits/barrier-attr.h>typedef struct __pthread_barrierattr pthread_barrierattr_t;/* Initialize barrier attribute object in *ATTR to the default   values.  */extern int pthread_barrierattr_init (pthread_barrierattr_t *attr);/* Destroy the barrier attribute object in *ATTR.  */extern int pthread_barrierattr_destroy (pthread_barrierattr_t *attr);/* Return the value of the process shared attribute in *ATTR in   *PSHARED.  */extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *attr,					   int *pshared);/* Set the value of the process shared atrribute in *ATTR to   PSHARED.  */extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *attr,					   int pshared);/* Barriers.  */#include <bits/barrier.h>typedef struct __pthread_barrier pthread_barrier_t;/* Returned by pthread_barrier_wait to exactly one thread each time a   barrier is passed.  */#define PTHREAD_BARRIER_SERIAL_THREAD -1/* Initialize barrier BARRIER.  */extern int pthread_barrier_init (pthread_barrier_t *barrier,				const pthread_barrierattr_t *attr,				unsigned count);/* Destroy barrier BARRIER.  */extern int pthread_barrier_destroy (pthread_barrier_t *barrier);/* Wait on barrier BARRIER.  */extern int pthread_barrier_wait (pthread_barrier_t *barrier);/* Thread specific data.  */#include <bits/thread-specific.h>typedef __pthread_key pthread_key_t;/* Create a thread specific data key in KEY visible to all threads.   On thread destruction, DESTRUCTOR shall be called with the thread   specific data associate with KEY if it is not NULL.  */extern int pthread_key_create (pthread_key_t *key,			       void (*destructor) (void *));/* Delete the thread specific data key KEY.  The associated destructor   function is not called.  */extern int pthread_key_delete (pthread_key_t key);/* Return the caller thread's thread specific value of KEY.  */extern void *pthread_getspecific (pthread_key_t key);/* Set the caller thread's thread specific value of KEY to VALUE.  */extern int pthread_setspecific (pthread_key_t key, const void *value);/* Dynamic package initialization.  */#include <bits/once.h>typedef struct __pthread_once pthread_once_t;#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT/* Call INIT_ROUTINE if this function has never been called with   *ONCE_CONTROL, otherwise do nothing.  */extern int pthread_once (pthread_once_t *once_control,			 void (*init_routine) (void));/* Concurrency.  *//* Set the desired concurrency level to NEW_LEVEL.  */extern int pthread_setconcurrency (int new_level);/* Get the current concurrency level.  */extern int pthread_getconcurrency (void);/* Forking.  *//* Register the function PREPARE to be run before the process forks,   the function PARENT to be run after a fork in the parent and the   function CHILD to be run in the child after the fork.  If no   handling is desired then any of PREPARE, PARENT and CHILD may be   NULL.  The prepare handles will be called in the reverse order   which they were registered and the parent and child handlers in the   order in which they were registered.  */extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),			   void (*child) (void));/* Signals (should be in <signal.h>).  *//* Send signal SIGNO to thread THREAD.  */extern int pthread_kill (pthread_t thread, int signo);/* Time.  *//* Return the thread cpu clock.  */extern int pthread_getcpuclockid (pthread_t thread, clockid_t *clock);/* Scheduling.  *//* Return thread THREAD's scheduling paramters.  */extern int pthread_getschedparam (pthread_t thread, int *policy,				  struct sched_param *param);/* Set thread THREAD's scheduling paramters.  */extern int pthread_setschedparam (pthread_t thread, int policy,				  const struct sched_param *param);/* Set thread THREAD's scheduling priority.  */extern int pthread_setschedprio (pthread_t thread, int prio);__END_DECLS#endif /* pthread.h */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -