Thread.h
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003  * 
00004  * Copyright (c) 2012 
00005  * 
00006  * SCHUNK GmbH & Co. KG
00007  *  
00008  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00009  * 
00010  * Project name: Drivers for "Amtec M5 Protocol" Electronics V4
00011  *                                                                        
00012  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00013  * 
00014  * Email:robotics@schunk.com
00015  * 
00016  * ToDo: 
00017  * 
00018  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00019  * 
00020  * Redistribution and use in source and binary forms, with or without 
00021  * modification, are permitted provided that the following conditions are met: 
00022  * 
00023  *  * Redistributions of source code must retain the above copyright 
00024  *    notice, this list of conditions and the following disclaimer. 
00025  *  * Redistributions in binary form must reproduce the above copyright 
00026  *    notice, this list of conditions and the following disclaimer in the 
00027  *    documentation and/or other materials provided with the distribution. 
00028  *  * Neither the name of SCHUNK GmbH & Co. KG nor the names of its 
00029  *    contributors may be used to endorse or promote products derived from 
00030  *    this software without specific prior written permission. 
00031  * 
00032  * This program is free software: you can redistribute it and/or modify 
00033  * it under the terms of the GNU Lesser General Public License LGPL as 
00034  * published by the Free Software Foundation, either version 3 of the 
00035  * License, or (at your option) any later version. 
00036  * 
00037  * This program is distributed in the hope that it will be useful, 
00038  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00039  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
00040  * GNU Lesser General Public License LGPL for more details. 
00041  * 
00042  * You should have received a copy of the GNU Lesser General Public 
00043  * License LGPL along with this program. 
00044  * If not, see <http://www.gnu.org/licenses/>.
00045  * 
00046  ******************************************************************************/
00047 
00048 
00049 #ifndef UTIL_THREAD_H
00050 #define UTIL_THREAD_H
00051 
00052 // ---- local includes ------------------------------------------------------ ;
00053 
00054 #include "../Util/Message.h"
00055 
00056 // ---- global includes ----------------------------------------------------- ;
00057 
00058 // ---- constants ----------------------------------------------------------- ;
00059 
00060 // ---- typedefs ------------------------------------------------------------ ;
00061 
00062 // ---- class definition ---------------------------------------------------- ;
00063 
00064 class CThread : public CMessage
00065 {
00066 
00067 private:
00068 
00069         // ---- private data ---------------------------------------------------- ;
00070 
00071         // ---- private auxiliary functions -------------------------------------- ;
00072 
00073 protected:
00074         
00075         // ---- protected data -------------------------------------------------- ;
00076 
00077                 unsigned int m_uiStackSize;
00078                 char* m_pcStack;
00079 #if defined (_WIN32)
00080                 HANDLE m_hThreadHandle;
00081 #endif
00082 #if defined(__LINUX__)
00083                 pthread_t m_hThreadHandle;
00084 #endif
00085 #if defined (__QNX__)
00086                 void* m_hThreadHandle;
00087 #endif
00088                 bool m_bThreadRunFlag;
00089                 bool m_bThreadStopFlag;
00090 
00091         // ---- protected auxiliary functions ------------------------------------- ;
00092 
00093 public:
00094 
00095         // ---- public data ------------------------------------------------------- ;
00096 
00097                 void* m_pvThreadObject;
00098                 void (*m_pfuThreadFunction)(CThread*);
00099 
00100                 // ---- constructors / destructor ----------------------------------------- ;
00101 
00102                 // default constructor
00103                 CThread();
00104                 // copy constructor
00105                 CThread(const CThread& clThread);
00106                 // destructor
00107                 ~CThread(void);
00108 
00109         // ---- operators --------------------------------------------------------- ;
00110         
00111                 // assignment operator
00112                 CThread& operator=(const CThread& clThread);
00113 
00114         // ---- query functions --------------------------------------------------- ;
00115 
00116         // ---- modify functions -------------------------------------------------- ;
00117         
00118                 void setThreadStackSize(unsigned int uiSize);
00119 
00120         // ---- I/O functions ----------------------------------------------------- ;
00121 
00122         // ---- exec functions ---------------------------------------------------- ;
00123 
00124                 int createThread(void (*fuThreadFunction)(CThread*), void* pThreadObject);
00125                 
00127                 void exitThread(); 
00128 
00130                 void terminateThread();
00131 
00133                 bool checkThreadRun();
00134 
00136                 bool checkThreadStop();
00137 };
00138 
00139 #endif


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Thu Aug 27 2015 15:06:52