• Main Page
  • Classes
  • Files
  • File List

IArchMultithread.h

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 IARCHMULTITHREAD_H
00020 #define IARCHMULTITHREAD_H
00021 
00022 #include "IInterface.h"
00023 
00030 class CArchCondImpl;
00031 
00037 typedef CArchCondImpl* CArchCond;
00038 
00044 class CArchMutexImpl;
00045 
00051 typedef CArchMutexImpl* CArchMutex;
00052 
00058 class CArchThreadImpl;
00059 
00065 typedef CArchThreadImpl* CArchThread;
00066 
00068 
00072 class IArchMultithread : public IInterface {
00073 public:
00075     typedef void* (*ThreadFunc)(void*);
00077     typedef unsigned int ThreadID;
00079 
00083     enum ESignal {
00084         kINTERRUPT,     
00085         kTERMINATE,     
00086         kHANGUP,        
00087         kUSER,          
00088         kNUM_SIGNALS
00089     };
00091     typedef void        (*SignalFunc)(ESignal, void* userData);
00092 
00094 
00095 
00096     //
00097     // condition variable methods
00098     //
00099 
00101 
00104     virtual CArchCond   newCondVar() = 0;
00105 
00107     virtual void        closeCondVar(CArchCond) = 0;
00108 
00110 
00113     virtual void        signalCondVar(CArchCond) = 0;
00114 
00116 
00119     virtual void        broadcastCondVar(CArchCond) = 0;
00120 
00122 
00132     virtual bool        waitCondVar(CArchCond, CArchMutex, double timeout) = 0;
00133 
00134     //
00135     // mutex methods
00136     //
00137 
00139 
00144     virtual CArchMutex  newMutex() = 0;
00145 
00147     virtual void        closeMutex(CArchMutex) = 0;
00148 
00150     virtual void        lockMutex(CArchMutex) = 0;
00151 
00153     virtual void        unlockMutex(CArchMutex) = 0;
00154 
00155     //
00156     // thread methods
00157     //
00158 
00160 
00164     virtual CArchThread newThread(ThreadFunc func, void* userData) = 0;
00165 
00167 
00170     virtual CArchThread newCurrentThread() = 0;
00171 
00173 
00176     virtual CArchThread copyThread(CArchThread thread) = 0;
00177 
00179 
00185     virtual void        closeThread(CArchThread) = 0;
00186 
00188 
00195     virtual void        cancelThread(CArchThread thread) = 0;
00196 
00198 
00203     virtual void        setPriorityOfThread(CArchThread, int n) = 0;
00204 
00206 
00213     virtual void        testCancelThread() = 0;
00214 
00216 
00224     virtual bool        wait(CArchThread thread, double timeout) = 0;
00225 
00227 
00231     virtual bool        isSameThread(CArchThread, CArchThread) = 0;
00232 
00234 
00237     virtual bool        isExitedThread(CArchThread thread) = 0;
00238 
00240 
00246     virtual void*       getResultOfThread(CArchThread thread) = 0;
00247 
00249 
00255     virtual ThreadID    getIDOfThread(CArchThread thread) = 0;
00256 
00258 
00262     virtual void        setSignalHandler(ESignal, SignalFunc func,
00263                             void* userData) = 0;
00264 
00266 
00271     virtual void        raiseSignal(ESignal signal) = 0;
00272 
00274 };
00275 
00276 #endif

Generated on Thu May 23 2013 00:00:04 for Synergy by  doxygen 1.7.1