[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 pthread_cond_t; |
---|
| 32 | typedef unsigned int pthread_condattr_t; |
---|
| 33 | typedef unsigned int pthread_rwlock_t; |
---|
| 34 | typedef unsigned int pthread_rwlockattr_t; |
---|
| 35 | typedef unsigned int pthread_key_t; |
---|
| 36 | |
---|
| 37 | /******************************************************************************************* |
---|
| 38 | * This structure and enum define the attributes for the pthread_create() syscall. |
---|
| 39 | ******************************************************************************************/ |
---|
| 40 | |
---|
| 41 | typedef unsigned int pthread_t; |
---|
| 42 | |
---|
| 43 | typedef struct pthread_attr_s |
---|
| 44 | { |
---|
| 45 | unsigned int attributes; /*! user defined attributes bit vector */ |
---|
| 46 | unsigned int cxy; /*! target cluster identifier */ |
---|
| 47 | unsigned int lid; /*! target core local index */ |
---|
| 48 | } |
---|
| 49 | pthread_attr_t; |
---|
| 50 | |
---|
| 51 | enum |
---|
| 52 | { |
---|
| 53 | PT_ATTR_DETACH = 0x0001, /*! user defined not joinable */ |
---|
| 54 | PT_ATTR_CLUSTER_DEFINED = 0x0002, /*! user defined target cluster */ |
---|
| 55 | PT_ATTR_CORE_DEFINED = 0x0004, /*! user defined core index in cluster */ |
---|
| 56 | }; |
---|
| 57 | |
---|
| 58 | /******************************************************************************************* |
---|
| 59 | * This enum defines the operation mnemonics for operations on POSIX condition variables. |
---|
| 60 | ******************************************************************************************/ |
---|
| 61 | |
---|
| 62 | typedef enum |
---|
| 63 | { |
---|
| 64 | CONDVAR_INIT, |
---|
| 65 | CONDVAR_DESTROY, |
---|
| 66 | CONDVAR_WAIT, |
---|
| 67 | CONDVAR_SIGNAL, |
---|
| 68 | CONDVAR_BROADCAST, |
---|
| 69 | } |
---|
| 70 | condvar_operation_t; |
---|
| 71 | |
---|
| 72 | /******************************************************************************************* |
---|
| 73 | * This enum defines the operation mnemonics for operations on POSIX barriers. |
---|
| 74 | ******************************************************************************************/ |
---|
| 75 | |
---|
| 76 | typedef enum |
---|
| 77 | { |
---|
| 78 | BARRIER_INIT, |
---|
| 79 | BARRIER_DESTROY, |
---|
| 80 | BARRIER_WAIT, |
---|
| 81 | } |
---|
| 82 | barrier_operation_t; |
---|
| 83 | |
---|
| 84 | /******************************************************************************************* |
---|
| 85 | * This enum defines the operation mnemonics for operations on POSIX mutex. |
---|
| 86 | ******************************************************************************************/ |
---|
| 87 | |
---|
| 88 | typedef enum |
---|
| 89 | { |
---|
| 90 | MUTEX_INIT, |
---|
| 91 | MUTEX_DESTROY, |
---|
| 92 | MUTEX_LOCK, |
---|
| 93 | MUTEX_UNLOCK, |
---|
| 94 | } |
---|
| 95 | mutex_operation_t; |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | #endif // _PTHREAD_H_ |
---|