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