00001 /* 00002 * synergy -- mouse and keyboard sharing utility 00003 * Copyright (C) 2012 Bolton Software Ltd. 00004 * Copyright (C) 2002 Chris Schoeneman 00005 * 00006 * This package is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * found in the file COPYING that should have accompanied this file. 00009 * 00010 * This package is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef CTHREAD_H 00020 #define CTHREAD_H 00021 00022 #include "IArchMultithread.h" 00023 00024 class IJob; 00025 00027 00043 // note -- do not derive from this class 00044 class CThread { 00045 public: 00047 00051 CThread(IJob* adoptedJob); 00052 00054 00058 CThread(const CThread&); 00059 00061 00066 ~CThread(); 00067 00069 00070 00072 00077 CThread& operator=(const CThread&); 00078 00080 00092 static void exit(void*); 00093 00095 00120 void cancel(); 00121 00123 00128 void setPriority(int n); 00129 00131 00135 void unblockPollSocket(); 00136 00138 00139 00140 00142 00145 static CThread getCurrentThread(); 00146 00148 00156 static void testCancel(); 00157 00159 00169 bool wait(double timeout = -1.0) const; 00170 00172 00179 void* getResult() const; 00180 00182 00187 IArchMultithread::ThreadID 00188 getID() const; 00189 00191 00194 bool operator==(const CThread&) const; 00195 00197 00200 bool operator!=(const CThread&) const; 00201 00203 00204 private: 00205 CThread(CArchThread); 00206 00207 static void* threadFunc(void*); 00208 00209 private: 00210 CArchThread m_thread; 00211 }; 00212 00213 #endif
1.7.1