cheshirekow  v0.1.0
enums.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of cpp-pthreads.
5  *
6  * cpp-pthreads is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * cpp-pthreads is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with cpp-pthreads. If not, see <http://www.gnu.org/licenses/>.
18  */
27 #ifndef CPP_PTHREADS_ENUMS_H_
28 #define CPP_PTHREADS_ENUMS_H_
29 
30 namespace pthreads {
31 
35  DETACHED = 0,
36  JOINABLE = 1,
40 };
41 
45  INHERIT = 0,
46  EXPLICIT = 1,
50 };
51 
57  RR,
62 };
63 
65 enum Scope {
66  SYSTEM = 0,
67  PROCESS = 1,
69 };
70 
72 enum PShared {
74  PRIVATE,
77 };
78 
80 enum Protocol {
85 };
86 
88 enum Type {
94 };
95 
97 template<typename Enum>
98 int* getEnumMap();
99 
102 template<typename Enum>
103 inline int mapEnum(Enum val) {
104  return getEnumMap<Enum>()[val];
105 }
106 
109 template<typename Enum>
110 Enum getEnum(int val);
111 
112 } // namespace pthreads
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 #endif // ENUMS_H_
Scope
Signifies process or system scheduling contention scope.
Definition: enums.h:65
thread must be join()ed by another thread for memory to be freed
Definition: enums.h:37
resource is shared by all processes who have access to the memory containing the resource handle ...
Definition: enums.h:73
thread is started in a detached state, when thread terminates, memory is automatically freed ...
Definition: enums.h:35
DetachState
controls whether a thread is created in a detached state, meaning that the thread will destroy itself...
Definition: enums.h:34
Enum getEnum(int val)
returns the pthread integer enumerator that corresponds to the specified value
Type
Types of mutexes.
Definition: enums.h:88
int * getEnumMap()
returns pointer to a map from enums to pthread enums (ints)
Protocol
Which progocol is used for priority.
Definition: enums.h:80
InheritSched
determines whether a thread inherits it's scheduling policy from the creating thread or if it uses th...
Definition: enums.h:44
PShared
indicates whether or not a resource is shared across processes
Definition: enums.h:72
SchedPolicy
if multiple threads are waiting on the same mutex, the Scheduling Policy determines the order in whic...
Definition: enums.h:54
int mapEnum(Enum val)
returns the pthread integer enumerator that corresponds to the specified value
Definition: enums.h:103
thread inherits scheduling policy from creating thread
Definition: enums.h:45
thread's scheduling policy is explicitly set in the Attr<Thread> object
Definition: enums.h:47
resource is private to the creating process
Definition: enums.h:75