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

📄 pth.h.in

📁 Linux下的中文输入法
💻 IN
📖 第 1 页 / 共 2 页
字号:
/***  GNU Pth - The GNU Portable Threads**  Copyright (c) 1999-2004 Ralf S. Engelschall <rse@engelschall.com>****  This file is part of GNU Pth, a non-preemptive thread scheduling**  library which can be found at http://www.gnu.org/software/pth/.****  This library is free software; you can redistribute it and/or**  modify it under the terms of the GNU Lesser General Public**  License as published by the Free Software Foundation; either**  version 2.1 of the License, or (at your option) any later version.****  This library is distributed in the hope that it will be useful,**  but WITHOUT ANY WARRANTY; without even the implied warranty of**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU**  Lesser General Public License for more details.****  You should have received a copy of the GNU Lesser General Public**  License along with this library; if not, write to the Free Software**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307**  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.****  pth.h: Pth public API definitions*/                             /* ``What you see is all you get.''                                          -- Brian Kernighan      */#ifndef _PTH_H_#define _PTH_H_    /* the library version */#ifndef PTH_VERSION_STR#define PTH_VERSION_STR "@PTH_VERSION_STR@"#endif#ifndef PTH_VERSION_HEX#define PTH_VERSION_HEX @PTH_VERSION_HEX@#endif#ifndef PTH_VERSION#define PTH_VERSION PTH_VERSION_HEX#endif    /* essential headers */#include <sys/types.h>     /* for ssize_t, off_t  */#include <time.h>          /* for struct timespec */#include <sys/time.h>      /* for struct timeval  */#include <sys/socket.h>    /* for sockaddr        */#include <sys/signal.h>    /* for sigset_t        */@EXTRA_INCLUDE_SYS_SELECT_H@    /* fallbacks for essential typedefs */#ifndef _PTHREAD_PRIVATE@FALLBACK_PID_T@@FALLBACK_SIZE_T@@FALLBACK_SSIZE_T@@FALLBACK_SOCKLEN_T@@FALLBACK_OFF_T@@FALLBACK_SIG_ATOMIC_T@@FALLBACK_NFDS_T@#endif /* !_PTHREAD_PRIVATE */    /* extra structure definitions */struct timeval;struct timespec;    /* essential values */#ifndef FALSE#define FALSE (0)#endif#ifndef TRUE#define TRUE (!FALSE)#endif#ifndef NUL#define NUL '\0'#endif#ifndef NULL#define NULL (void *)0#endif    /* bitmask generation */#define _BIT(n) (1<<(n))    /* C++ support */#ifdef __cplusplus#define BEGIN_DECLARATION extern "C" {#define END_DECLARATION   }#else#define BEGIN_DECLARATION /*nop*/#define END_DECLARATION   /*nop*/#endif    /* check if the user requests a bigger FD_SETSIZE than we can handle */#if defined(FD_SETSIZE)#if FD_SETSIZE > @PTH_FDSETSIZE@#error "FD_SETSIZE is larger than what GNU Pth can handle."#endif#endifBEGIN_DECLARATION    /* some global constants */#define PTH_KEY_MAX                  256#define PTH_ATFORK_MAX               128#define PTH_DESTRUCTOR_ITERATIONS    4    /* system call mapping support type (soft variant can be overridden) */#define PTH_SYSCALL_HARD @PTH_SYSCALL_HARD@#ifndef PTH_SYSCALL_SOFT#define PTH_SYSCALL_SOFT @PTH_SYSCALL_SOFT@#endif    /* queries for pth_ctrl() */#define PTH_CTRL_GETAVLOAD            _BIT(1)#define PTH_CTRL_GETPRIO              _BIT(2)#define PTH_CTRL_GETNAME              _BIT(3)#define PTH_CTRL_GETTHREADS_NEW       _BIT(4)#define PTH_CTRL_GETTHREADS_READY     _BIT(5)#define PTH_CTRL_GETTHREADS_RUNNING   _BIT(6)#define PTH_CTRL_GETTHREADS_WAITING   _BIT(7)#define PTH_CTRL_GETTHREADS_SUSPENDED _BIT(8)#define PTH_CTRL_GETTHREADS_DEAD      _BIT(9)#define PTH_CTRL_GETTHREADS           (PTH_CTRL_GETTHREADS_NEW|\                                       PTH_CTRL_GETTHREADS_READY|\                                       PTH_CTRL_GETTHREADS_RUNNING|\                                       PTH_CTRL_GETTHREADS_WAITING|\                                       PTH_CTRL_GETTHREADS_SUSPENDED|\                                       PTH_CTRL_GETTHREADS_DEAD)#define PTH_CTRL_DUMPSTATE            _BIT(10)#define PTH_CTRL_FAVOURNEW            _BIT(11)    /* the time value structure */typedef struct timeval pth_time_t;    /* the unique thread id/handle */typedef struct pth_st *pth_t;struct pth_st;    /* thread states */typedef enum pth_state_en {    PTH_STATE_SCHEDULER = 0,         /* the special scheduler thread only       */    PTH_STATE_NEW,                   /* spawned, but still not dispatched       */    PTH_STATE_READY,                 /* ready, waiting to be dispatched         */    PTH_STATE_WAITING,               /* suspended, waiting until event occurred */    PTH_STATE_DEAD                   /* terminated, waiting to be joined        */} pth_state_t;    /* thread priority values */#define PTH_PRIO_MAX                 +5#define PTH_PRIO_STD                  0#define PTH_PRIO_MIN                 -5    /* the thread attribute structure */typedef struct pth_attr_st *pth_attr_t;struct pth_attr_st;    /* attribute set/get commands for pth_attr_{get,set}() */enum {    PTH_ATTR_PRIO,           /* RW [int]               priority of thread                */    PTH_ATTR_NAME,           /* RW [char *]            name of thread                    */    PTH_ATTR_JOINABLE,       /* RW [int]               thread detachment type            */    PTH_ATTR_CANCEL_STATE,   /* RW [unsigned int]      thread cancellation state         */    PTH_ATTR_STACK_SIZE,     /* RW [unsigned int]      stack size                        */    PTH_ATTR_STACK_ADDR,     /* RW [char *]            stack lower address               */    PTH_ATTR_DISPATCHES,     /* RO [int]               total number of thread dispatches */    PTH_ATTR_TIME_SPAWN,     /* RO [pth_time_t]        time thread was spawned           */    PTH_ATTR_TIME_LAST,      /* RO [pth_time_t]        time thread was last dispatched   */    PTH_ATTR_TIME_RAN,       /* RO [pth_time_t]        time thread was running           */    PTH_ATTR_START_FUNC,     /* RO [void *(*)(void *)] thread start function             */    PTH_ATTR_START_ARG,      /* RO [void *]            thread start argument             */    PTH_ATTR_STATE,          /* RO [pth_state_t]       scheduling state                  */    PTH_ATTR_EVENTS,         /* RO [pth_event_t]       events the thread is waiting for  */    PTH_ATTR_BOUND           /* RO [int]               whether object is bound to thread */};    /* default thread attribute */#define PTH_ATTR_DEFAULT (pth_attr_t)(0)    /* the event structure */typedef struct pth_event_st *pth_event_t;struct pth_event_st;    /* event subject classes */#define PTH_EVENT_FD                 _BIT(1)#define PTH_EVENT_SELECT             _BIT(2)#define PTH_EVENT_SIGS               _BIT(3)#define PTH_EVENT_TIME               _BIT(4)#define PTH_EVENT_MSG                _BIT(5)#define PTH_EVENT_MUTEX              _BIT(6)#define PTH_EVENT_COND               _BIT(7)#define PTH_EVENT_TID                _BIT(8)#define PTH_EVENT_FUNC               _BIT(9)    /* event occurange restrictions */#define PTH_UNTIL_OCCURRED           _BIT(11)#define PTH_UNTIL_FD_READABLE        _BIT(12)#define PTH_UNTIL_FD_WRITEABLE       _BIT(13)#define PTH_UNTIL_FD_EXCEPTION       _BIT(14)#define PTH_UNTIL_TID_NEW            _BIT(15)#define PTH_UNTIL_TID_READY          _BIT(16)#define PTH_UNTIL_TID_WAITING        _BIT(17)#define PTH_UNTIL_TID_DEAD           _BIT(18)    /* event structure handling modes */#define PTH_MODE_REUSE               _BIT(20)#define PTH_MODE_CHAIN               _BIT(21)#define PTH_MODE_STATIC              _BIT(22)    /* event deallocation types */enum { PTH_FREE_THIS, PTH_FREE_ALL };    /* event walking directions */#define PTH_WALK_NEXT                _BIT(1)#define PTH_WALK_PREV                _BIT(2)    /* event status codes */typedef enum {    PTH_STATUS_PENDING,    PTH_STATUS_OCCURRED,    PTH_STATUS_FAILED} pth_status_t;    /* the key type and init value */typedef int pth_key_t;#define PTH_KEY_INIT (-1)    /* the once structure and init value */typedef int pth_once_t;#define PTH_ONCE_INIT FALSE    /* general ring structure */typedef struct pth_ringnode_st pth_ringnode_t;struct pth_ringnode_st {    pth_ringnode_t *rn_next;    pth_ringnode_t *rn_prev;};typedef struct pth_ring_st pth_ring_t;struct pth_ring_st {    pth_ringnode_t *r_hook;    unsigned int    r_nodes;};#define PTH_RING_INIT { NULL }    /* cancellation values */#define PTH_CANCEL_ENABLE            _BIT(0)#define PTH_CANCEL_DISABLE           _BIT(1)#define PTH_CANCEL_ASYNCHRONOUS      _BIT(2)#define PTH_CANCEL_DEFERRED          _BIT(3)#define PTH_CANCEL_DEFAULT           (PTH_CANCEL_ENABLE|PTH_CANCEL_DEFERRED)#define PTH_CANCELED                 ((void *)-1)   /* mutex values */#define PTH_MUTEX_INITIALIZED        _BIT(0)#define PTH_MUTEX_LOCKED             _BIT(1)#define PTH_MUTEX_INIT               { {NULL, NULL}, PTH_MUTEX_INITIALIZED, NULL, 0 }   /* read-write lock values */enum { PTH_RWLOCK_RD, PTH_RWLOCK_RW };#define PTH_RWLOCK_INITIALIZED       _BIT(0)#define PTH_RWLOCK_INIT              { PTH_RWLOCK_INITIALIZED, PTH_RWLOCK_RD, 0, \                                       PTH_MUTEX_INIT, PTH_MUTEX_INIT }   /* condition variable values */#define PTH_COND_INITIALIZED         _BIT(0)#define PTH_COND_SIGNALED            _BIT(1)#define PTH_COND_BROADCAST           _BIT(2)#define PTH_COND_HANDLED             _BIT(3)#define PTH_COND_INIT                { PTH_COND_INITIALIZED, 0 }   /* barrier variable values */#define PTH_BARRIER_INITIALIZED      _BIT(0)#define PTH_BARRIER_INIT(threshold)  { PTH_BARRIER_INITIALIZED, \                                       (threshold), (threshold), FALSE, \                                       PTH_COND_INIT, PTH_MUTEX_INIT }#define PTH_BARRIER_HEADLIGHT        (-1)#define PTH_BARRIER_TAILLIGHT        (-2)    /* the message port structure */typedef struct pth_msgport_st *pth_msgport_t;struct pth_msgport_st;    /* the message structure */typedef struct pth_message_st pth_message_t;struct pth_message_st { /* not hidden to allow inclusion */    pth_ringnode_t m_node;    pth_msgport_t  m_replyport;    unsigned int   m_size;    void          *m_data;};    /* the mutex structure */typedef struct pth_mutex_st pth_mutex_t;struct pth_mutex_st { /* not hidden to avoid destructor */    pth_ringnode_t mx_node;    int            mx_state;    pth_t          mx_owner;    unsigned long  mx_count;};

⌨️ 快捷键说明

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