00001 /* 00002 * synergy -- mouse and keyboard sharing utility 00003 * Copyright (C) 2002 Chris Schoeneman 00004 * 00005 * This package is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * found in the file COPYING that should have accompanied this file. 00008 * 00009 * This package is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 */ 00014 00015 #ifndef CTHREAD_H 00016 #define CTHREAD_H 00017 00018 #include "IArchMultithread.h" 00019 00020 class IJob; 00021 00023 00039 // note -- do not derive from this class 00040 class CThread { 00041 public: 00043 00047 CThread(IJob* adoptedJob); 00048 00050 00054 CThread(const CThread&); 00055 00057 00062 ~CThread(); 00063 00065 00066 00068 00073 CThread& operator=(const CThread&); 00074 00076 00088 static void exit(void*); 00089 00091 00116 void cancel(); 00117 00119 00124 void setPriority(int n); 00125 00127 00131 void unblockPollSocket(); 00132 00134 00135 00136 00138 00141 static CThread getCurrentThread(); 00142 00144 00152 static void testCancel(); 00153 00155 00165 bool wait(double timeout = -1.0) const; 00166 00168 00175 void* getResult() const; 00176 00178 00183 IArchMultithread::ThreadID 00184 getID() const; 00185 00187 00190 bool operator==(const CThread&) const; 00191 00193 00196 bool operator!=(const CThread&) const; 00197 00199 00200 private: 00201 CThread(CArchThread); 00202 00203 static void* threadFunc(void*); 00204 00205 private: 00206 CArchThread m_thread; 00207 }; 00208 00209 #endif