Thread.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 SCHUNK GmbH & Co. KG
3  * Copyright (c) 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10 
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef UTIL_THREAD_H
19 #define UTIL_THREAD_H
20 
21 // ---- local includes ------------------------------------------------------ ;
22 
23 #include "../Util/Message.h"
24 
25 // ---- global includes ----------------------------------------------------- ;
26 
27 // ---- constants ----------------------------------------------------------- ;
28 
29 // ---- typedefs ------------------------------------------------------------ ;
30 
31 // ---- class definition ---------------------------------------------------- ;
32 
33 class CThread : public CMessage
34 {
35 
36 private:
37 
38  // ---- private data ---------------------------------------------------- ;
39 
40  // ---- private auxiliary functions -------------------------------------- ;
41 
42 protected:
43 
44  // ---- protected data -------------------------------------------------- ;
45 
46  unsigned int m_uiStackSize;
47  char* m_pcStack;
48 #if defined (_WIN32)
49  HANDLE m_hThreadHandle;
50 #endif
51 #if defined(__LINUX__)
52  pthread_t m_hThreadHandle;
53 #endif
54 #if defined (__QNX__)
55  void* m_hThreadHandle;
56 #endif
59 
60  // ---- protected auxiliary functions ------------------------------------- ;
61 
62 public:
63 
64  // ---- public data ------------------------------------------------------- ;
65 
68 
69  // ---- constructors / destructor ----------------------------------------- ;
70 
71  // default constructor
72  CThread();
73  // copy constructor
74  CThread(const CThread& clThread);
75  // destructor
76  ~CThread(void);
77 
78  // ---- operators --------------------------------------------------------- ;
79 
80  // assignment operator
81  CThread& operator=(const CThread& clThread);
82 
83  // ---- query functions --------------------------------------------------- ;
84 
85  // ---- modify functions -------------------------------------------------- ;
86 
87  void setThreadStackSize(unsigned int uiSize);
88 
89  // ---- I/O functions ----------------------------------------------------- ;
90 
91  // ---- exec functions ---------------------------------------------------- ;
92 
93  int createThread(void (*fuThreadFunction)(CThread*), void* pThreadObject);
94 
96  void exitThread();
97 
99  void terminateThread();
100 
102  bool checkThreadRun();
103 
105  bool checkThreadStop();
106 };
107 
108 #endif
bool m_bThreadRunFlag
Definition: Thread.h:57
CThread & operator=(const CThread &clThread)
Definition: Thread.cpp:79
int createThread(void(*fuThreadFunction)(CThread *), void *pThreadObject)
Definition: Thread.cpp:114
Definition: Thread.h:33
void * m_pvThreadObject
Definition: Thread.h:66
void setThreadStackSize(unsigned int uiSize)
Definition: Thread.cpp:97
bool m_bThreadStopFlag
Definition: Thread.h:58
void exitThread()
called inside the thread function before leaving the thread
Definition: Thread.cpp:182
void terminateThread()
called outside the thread function to terminate the thread
Definition: Thread.cpp:193
unsigned int m_uiStackSize
Definition: Thread.h:46
bool checkThreadRun()
check outside the thread function to check running
Definition: Thread.cpp:198
char * m_pcStack
Definition: Thread.h:47
CThread()
Definition: Thread.cpp:52
bool checkThreadStop()
check inside the thread function to check termination
Definition: Thread.cpp:203
~CThread(void)
Definition: Thread.cpp:68
void(* m_pfuThreadFunction)(CThread *)
Definition: Thread.h:67


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Mon Nov 25 2019 03:48:19