[444] | 1 | #ifndef _SHARED_PTHREAD_H_ |
---|
| 2 | #define _SHARED_PTHREAD_H_ |
---|
| 3 | |
---|
| 4 | /******************************************************************************************* |
---|
| 5 | * These typedef define the POSIX thread related types. |
---|
| 6 | ******************************************************************************************/ |
---|
| 7 | |
---|
| 8 | typedef unsigned int sem_t; |
---|
| 9 | typedef unsigned int pthread_cond_t; |
---|
| 10 | typedef unsigned int pthread_condattr_t; |
---|
| 11 | typedef unsigned int pthread_rwlock_t; |
---|
| 12 | typedef unsigned int pthread_rwlockattr_t; |
---|
| 13 | typedef unsigned int pthread_key_t; |
---|
| 14 | |
---|
| 15 | /******************************************************************************************* |
---|
| 16 | * This structure and enum define the attributes for the "pthread_create" syscall. |
---|
| 17 | ******************************************************************************************/ |
---|
| 18 | |
---|
| 19 | typedef unsigned int pthread_t; |
---|
| 20 | |
---|
| 21 | typedef struct pthread_attr_s |
---|
| 22 | { |
---|
| 23 | unsigned int attributes; /*! user defined attributes bit vector */ |
---|
| 24 | unsigned int cxy; /*! target cluster identifier */ |
---|
| 25 | unsigned int lid; /*! target core local index */ |
---|
| 26 | } |
---|
| 27 | pthread_attr_t; |
---|
| 28 | |
---|
| 29 | enum |
---|
| 30 | { |
---|
| 31 | PT_ATTR_DETACH = 0x0001, /*! user defined not joinable */ |
---|
| 32 | PT_ATTR_CLUSTER_DEFINED = 0x0002, /*! user defined target cluster */ |
---|
| 33 | PT_ATTR_CORE_DEFINED = 0x0004, /*! user defined core index in cluster */ |
---|
| 34 | }; |
---|
| 35 | |
---|
| 36 | /******************************************************************************************* |
---|
| 37 | * This enum defines the operation mnemonics for operations on POSIX unnamed semaphores. |
---|
| 38 | ******************************************************************************************/ |
---|
| 39 | |
---|
| 40 | typedef enum |
---|
| 41 | { |
---|
| 42 | SEM_INIT, |
---|
| 43 | SEM_DESTROY, |
---|
| 44 | SEM_GETVALUE, |
---|
| 45 | SEM_WAIT, |
---|
| 46 | SEM_POST, |
---|
| 47 | } |
---|
| 48 | sem_operation_t; |
---|
| 49 | |
---|
| 50 | /******************************************************************************************* |
---|
| 51 | * This enum defines the operation mnemonics for operations on POSIX condition variables. |
---|
| 52 | ******************************************************************************************/ |
---|
| 53 | |
---|
| 54 | typedef enum |
---|
| 55 | { |
---|
| 56 | CONDVAR_INIT, |
---|
| 57 | CONDVAR_DESTROY, |
---|
| 58 | CONDVAR_WAIT, |
---|
| 59 | CONDVAR_SIGNAL, |
---|
| 60 | CONDVAR_BROADCAST, |
---|
| 61 | } |
---|
| 62 | condvar_operation_t; |
---|
| 63 | |
---|
| 64 | /******************************************************************************************* |
---|
| 65 | * This enum defines the operation mnemonics for operations on POSIX barriers. |
---|
| 66 | ******************************************************************************************/ |
---|
| 67 | |
---|
| 68 | typedef enum |
---|
| 69 | { |
---|
| 70 | BARRIER_INIT, |
---|
| 71 | BARRIER_DESTROY, |
---|
| 72 | BARRIER_WAIT, |
---|
| 73 | } |
---|
| 74 | barrier_operation_t; |
---|
| 75 | |
---|
| 76 | /******************************************************************************************* |
---|
| 77 | * This enum defines the operation mnemonics for operations on POSIX mutex. |
---|
| 78 | ******************************************************************************************/ |
---|
| 79 | |
---|
| 80 | typedef enum |
---|
| 81 | { |
---|
| 82 | MUTEX_INIT, |
---|
| 83 | MUTEX_DESTROY, |
---|
| 84 | MUTEX_LOCK, |
---|
| 85 | MUTEX_UNLOCK, |
---|
| 86 | } |
---|
| 87 | mutex_operation_t; |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | #endif // _PTHREAD_H_ |
---|