source: trunk/kernel/syscalls/shared_include/shared_pthread.h @ 570

Last change on this file since 570 was 566, checked in by alain, 6 years ago

Complete restructuration of kernel locks.

File size: 3.9 KB
Line 
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 *    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/*******************************************************************************************
34 * These typedef define the POSIX thread related types.
35 ******************************************************************************************/
36
37typedef unsigned int      pthread_mutex_t;
38typedef unsigned int      pthread_mutexattr_t;         // TODO not implemented
39
40typedef unsigned int      pthread_cond_t;
41typedef unsigned int      pthread_condattr_t;          // TODO not implemented
42
43typedef unsigned int      pthread_rwlock_t;            // TODO not implemented
44typedef unsigned int      pthread_rwlockattr_t;        // TODO not implemented
45
46/*******************************************************************************************
47 * This structure and enum define the attributes for the pthread_create() syscall.
48 ******************************************************************************************/
49
50typedef unsigned int  pthread_t;               
51
52typedef 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}
58pthread_attr_t;
59
60enum
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
71typedef enum
72{
73        CONDVAR_INIT,
74        CONDVAR_DESTROY,
75    CONDVAR_WAIT,
76    CONDVAR_SIGNAL,
77    CONDVAR_BROADCAST,
78} 
79condvar_operation_t;
80
81/*******************************************************************************************
82 * This enum defines the operation mnemonics for operations on POSIX barriers.
83 ******************************************************************************************/
84
85typedef enum
86{
87        BARRIER_INIT,
88        BARRIER_DESTROY,
89        BARRIER_WAIT,
90} 
91barrier_operation_t;
92
93/*******************************************************************************************
94 * This enum defines the operation mnemonics for operations on POSIX mutex.
95 ******************************************************************************************/
96
97typedef enum
98{
99        MUTEX_INIT,
100        MUTEX_DESTROY,
101        MUTEX_LOCK,
102        MUTEX_UNLOCK,
103    MUTEX_TRYLOCK,
104} 
105mutex_operation_t;
106
107
108
109#endif  // _PTHREAD_H_
Note: See TracBrowser for help on using the repository browser.