[445] | 1 | /* |
---|
| 2 | * shared_pthread.h - Shared structures and mnemonics used by the pthread related syscalls. |
---|
| 3 | * |
---|
| 4 | * Author Alain Greiner (2016,2017,2018) |
---|
| 5 | * |
---|
| 6 | * Copyright (c) UPMC Sorbonne Universites |
---|
| 7 | * |
---|
| 8 | * This file is part of ALMOS-MKH. |
---|
| 9 | * |
---|
| 10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
| 11 | * under the terms of the GNU General Public License as published by |
---|
| 12 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 13 | * |
---|
| 14 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 17 | * General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
| 21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | #ifndef _SHARED_PTHREAD_H_ |
---|
| 25 | #define _SHARED_PTHREAD_H_ |
---|
| 26 | |
---|
| 27 | /******************************************************************************************* |
---|
| 28 | * These typedef define the POSIX thread related types. |
---|
| 29 | ******************************************************************************************/ |
---|
| 30 | |
---|
| 31 | typedef unsigned int sem_t; |
---|
| 32 | typedef unsigned int pthread_cond_t; |
---|
| 33 | typedef unsigned int pthread_condattr_t; |
---|
| 34 | typedef unsigned int pthread_rwlock_t; |
---|
| 35 | typedef unsigned int pthread_rwlockattr_t; |
---|
| 36 | typedef unsigned int pthread_key_t; |
---|
| 37 | |
---|
| 38 | /******************************************************************************************* |
---|
| 39 | * This structure and enum define the attributes for the pthread_create() syscall. |
---|
| 40 | ******************************************************************************************/ |
---|
| 41 | |
---|
| 42 | typedef unsigned int pthread_t; |
---|
| 43 | |
---|
| 44 | typedef struct pthread_attr_s |
---|
| 45 | { |
---|
| 46 | unsigned int attributes; /*! user defined attributes bit vector */ |
---|
| 47 | unsigned int cxy; /*! target cluster identifier */ |
---|
| 48 | unsigned int lid; /*! target core local index */ |
---|
| 49 | } |
---|
| 50 | pthread_attr_t; |
---|
| 51 | |
---|
| 52 | enum |
---|
| 53 | { |
---|
| 54 | PT_ATTR_DETACH = 0x0001, /*! user defined not joinable */ |
---|
| 55 | PT_ATTR_CLUSTER_DEFINED = 0x0002, /*! user defined target cluster */ |
---|
| 56 | PT_ATTR_CORE_DEFINED = 0x0004, /*! user defined core index in cluster */ |
---|
| 57 | }; |
---|
| 58 | |
---|
| 59 | /******************************************************************************************* |
---|
| 60 | * This enum defines the operation mnemonics for operations on POSIX unnamed semaphores. |
---|
| 61 | ******************************************************************************************/ |
---|
| 62 | |
---|
| 63 | typedef enum |
---|
| 64 | { |
---|
| 65 | SEM_INIT, |
---|
| 66 | SEM_DESTROY, |
---|
| 67 | SEM_GETVALUE, |
---|
| 68 | SEM_WAIT, |
---|
| 69 | SEM_POST, |
---|
| 70 | } |
---|
| 71 | sem_operation_t; |
---|
| 72 | |
---|
| 73 | /******************************************************************************************* |
---|
| 74 | * This enum defines the operation mnemonics for operations on POSIX condition variables. |
---|
| 75 | ******************************************************************************************/ |
---|
| 76 | |
---|
| 77 | typedef enum |
---|
| 78 | { |
---|
| 79 | CONDVAR_INIT, |
---|
| 80 | CONDVAR_DESTROY, |
---|
| 81 | CONDVAR_WAIT, |
---|
| 82 | CONDVAR_SIGNAL, |
---|
| 83 | CONDVAR_BROADCAST, |
---|
| 84 | } |
---|
| 85 | condvar_operation_t; |
---|
| 86 | |
---|
| 87 | /******************************************************************************************* |
---|
| 88 | * This enum defines the operation mnemonics for operations on POSIX barriers. |
---|
| 89 | ******************************************************************************************/ |
---|
| 90 | |
---|
| 91 | typedef enum |
---|
| 92 | { |
---|
| 93 | BARRIER_INIT, |
---|
| 94 | BARRIER_DESTROY, |
---|
| 95 | BARRIER_WAIT, |
---|
| 96 | } |
---|
| 97 | barrier_operation_t; |
---|
| 98 | |
---|
| 99 | /******************************************************************************************* |
---|
| 100 | * This enum defines the operation mnemonics for operations on POSIX mutex. |
---|
| 101 | ******************************************************************************************/ |
---|
| 102 | |
---|
| 103 | typedef enum |
---|
| 104 | { |
---|
| 105 | MUTEX_INIT, |
---|
| 106 | MUTEX_DESTROY, |
---|
| 107 | MUTEX_LOCK, |
---|
| 108 | MUTEX_UNLOCK, |
---|
| 109 | } |
---|
| 110 | mutex_operation_t; |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | |
---|
| 114 | #endif // _PTHREAD_H_ |
---|