Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

IArchMultithread.h

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 IARCHMULTITHREAD_H
00016 #define IARCHMULTITHREAD_H
00017 
00018 #include "IInterface.h"
00019 
00026 class CArchCondImpl;
00027 
00033 typedef CArchCondImpl* CArchCond;
00034 
00040 class CArchMutexImpl;
00041 
00047 typedef CArchMutexImpl* CArchMutex;
00048 
00054 class CArchThreadImpl;
00055 
00061 typedef CArchThreadImpl* CArchThread;
00062 
00064 
00068 class IArchMultithread : public IInterface {
00069 public:
00071     typedef void* (*ThreadFunc)(void*);
00073     typedef unsigned int ThreadID;
00075 
00079     enum ESignal {
00080         kINTERRUPT,     
00081         kTERMINATE,     
00082         kHANGUP,        
00083         kUSER,          
00084         kNUM_SIGNALS
00085     };
00087     typedef void        (*SignalFunc)(ESignal, void* userData);
00088 
00090 
00091 
00092     //
00093     // condition variable methods
00094     //
00095 
00097 
00100     virtual CArchCond   newCondVar() = 0;
00101 
00103     virtual void        closeCondVar(CArchCond) = 0;
00104 
00106 
00109     virtual void        signalCondVar(CArchCond) = 0;
00110 
00112 
00115     virtual void        broadcastCondVar(CArchCond) = 0;
00116 
00118 
00128     virtual bool        waitCondVar(CArchCond, CArchMutex, double timeout) = 0;
00129 
00130     //
00131     // mutex methods
00132     //
00133 
00135 
00140     virtual CArchMutex  newMutex() = 0;
00141 
00143     virtual void        closeMutex(CArchMutex) = 0;
00144 
00146     virtual void        lockMutex(CArchMutex) = 0;
00147 
00149     virtual void        unlockMutex(CArchMutex) = 0;
00150 
00151     //
00152     // thread methods
00153     //
00154 
00156 
00160     virtual CArchThread newThread(ThreadFunc func, void* userData) = 0;
00161 
00163 
00166     virtual CArchThread newCurrentThread() = 0;
00167 
00169 
00172     virtual CArchThread copyThread(CArchThread thread) = 0;
00173 
00175 
00181     virtual void        closeThread(CArchThread) = 0;
00182 
00184 
00191     virtual void        cancelThread(CArchThread thread) = 0;
00192 
00194 
00199     virtual void        setPriorityOfThread(CArchThread, int n) = 0;
00200 
00202 
00209     virtual void        testCancelThread() = 0;
00210 
00212 
00220     virtual bool        wait(CArchThread thread, double timeout) = 0;
00221 
00223 
00227     virtual bool        isSameThread(CArchThread, CArchThread) = 0;
00228 
00230 
00233     virtual bool        isExitedThread(CArchThread thread) = 0;
00234 
00236 
00242     virtual void*       getResultOfThread(CArchThread thread) = 0;
00243 
00245 
00251     virtual ThreadID    getIDOfThread(CArchThread thread) = 0;
00252 
00254 
00258     virtual void        setSignalHandler(ESignal, SignalFunc func,
00259                             void* userData) = 0;
00260 
00262 
00267     virtual void        raiseSignal(ESignal signal) = 0;
00268 
00270 };
00271 
00272 #endif

Generated on Fri Nov 6 00:21:15 2009 for synergy-plus by  doxygen 1.3.9.1