Update of /cvsroot/pclasses/pclasses2/include/pclasses/System
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16395/include/pclasses/System
Modified Files:
Thread.h
Log Message:
Added Thread::spawn() for spawning callback's in own threads.
Added inline docs.
Removed void* arg from Thread::main() and Thread::start().
Index: Thread.h
===================================================================
RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Thread.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Thread.h 24 Jan 2005 01:19:25 -0000 1.3
+++ Thread.h 28 Jan 2005 11:36:37 -0000 1.4
@@ -24,27 +24,42 @@
#include <pclasses/Export.h>
#include <pclasses/Exception.h>
#include <pclasses/NonCopyable.h>
+#include <pclasses/Callback.h>
#include <pclasses/System/SystemError.h>
namespace P {
namespace System {
+class Semaphore;
+
+//! Simple threading class
class PSYSTEM_EXPORT Thread: public NonCopyable {
public:
Thread(bool detached) throw();
virtual ~Thread() throw();
- void start(void* arg) throw(LogicError, SystemError);
- int join() throw(LogicError, SystemError);
+ //! Start the thread
+ virtual void start() throw(LogicError, SystemError);
+ //! Wait for thread termination
+ /*!
+ Wait until the thread has exited.
+ \return the threads exit-code (returned by main())
+ */
+ virtual int join() throw(LogicError, SystemError);
+
+ //! Test if thread is detached
bool detached() const throw();
static void yield() throw();
static void sleep(unsigned int ms) throw();
+ static void spawn(const Callback0<void>& cb, Semaphore* sem = 0)
+ throw(SystemError);
+
protected:
- virtual int main(void* arg) = 0;
+ virtual int main() = 0;
private:
struct Handle;
|