X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/78e87bf7b8fb25529f77881834c75ae1614e6552..a70ab3b804b6c363f8bcbed0b4fce94b7fb03612:/interface/wx/thread.h diff --git a/interface/wx/thread.h b/interface/wx/thread.h index 3d9d11329c..2007458cf0 100644 --- a/interface/wx/thread.h +++ b/interface/wx/thread.h @@ -130,7 +130,7 @@ public: @see Signal() */ - void Broadcast(); + wxCondError Broadcast(); /** Returns @true if the object had been initialized successfully, @false @@ -151,7 +151,7 @@ public: @see Broadcast() */ - void Signal(); + wxCondError Signal(); /** Waits until the condition is signalled. @@ -310,19 +310,6 @@ public: */ virtual ~wxThreadHelper(); - /** - Creates a new thread. - - The thread object is created in the suspended state, and you - should call @ref wxThread::Run GetThread()-Run to start running it. - - You may optionally specify the stack size to be allocated to it (ignored - on platforms that don't support setting it explicitly, eg. Unix). - - @return One of the ::wxThreadError enum values. - */ - wxThreadError Create(unsigned int stackSize = 0); - /** This is the entry point of the thread. @@ -335,7 +322,20 @@ public: This function is called by wxWidgets itself and should never be called directly. */ - virtual ExitCode Entry(); + virtual ExitCode Entry() = 0; + + /** + Creates a new thread. + + The thread object is created in the suspended state, and you + should call @ref wxThread::Run GetThread()-Run to start running it. + + You may optionally specify the stack size to be allocated to it (ignored + on platforms that don't support setting it explicitly, eg. Unix). + + @return One of the ::wxThreadError enum values. + */ + wxThreadError Create(unsigned int stackSize = 0); /** This is a public function that returns the wxThread object @@ -632,31 +632,7 @@ public: See @ref thread_deletion for a broader explanation of this routine. */ - wxThreadError Delete(); - - /** - This is the entry point of the thread. - - This function is pure virtual and must be implemented by any derived class. - The thread execution will start here. - - The returned value is the thread exit code which is only useful for - joinable threads and is the value returned by Wait(). - This function is called by wxWidgets itself and should never be called - directly. - */ - virtual ExitCode Entry(); - - /** - This is a protected function of the wxThread class and thus can only be called - from a derived class. It also can only be called in the context of this - thread, i.e. a thread can only exit from itself, not from another thread. - - This function will terminate the OS thread (i.e. stop the associated path of - execution) and also delete the associated C++ object for detached threads. - OnExit() will be called just before exiting. - */ - void Exit(ExitCode exitcode = 0); + wxThreadError Delete(void** rc = NULL); /** Returns the number of system CPUs or -1 if the value is unknown. @@ -676,7 +652,7 @@ public: identifies the thread throughout the system during its existence (i.e. the thread identifiers may be reused). */ - unsigned long GetId() const; + wxThreadIdType GetId() const; /** Gets the priority of the thread, between zero and 100. @@ -686,7 +662,7 @@ public: - @b WXTHREAD_DEFAULT_PRIORITY: 50 - @b WXTHREAD_MAX_PRIORITY: 100 */ - int GetPriority() const; + unsigned int GetPriority() const; /** Returns @true if the thread is alive (i.e. started and not terminating). @@ -805,7 +781,7 @@ public: - @b WXTHREAD_DEFAULT_PRIORITY: 50 - @b WXTHREAD_MAX_PRIORITY: 100 */ - void SetPriority(int priority); + void SetPriority(unsigned int priority); /** Pauses the thread execution for the given amount of time. @@ -846,7 +822,7 @@ public: See @ref thread_deletion for a broader explanation of this routine. */ - ExitCode Wait() const; + ExitCode Wait(); /** Give the rest of the thread time slice to the system allowing the other @@ -883,6 +859,32 @@ public: See also Sleep(). */ static void Yield(); + +protected: + + /** + This is the entry point of the thread. + + This function is pure virtual and must be implemented by any derived class. + The thread execution will start here. + + The returned value is the thread exit code which is only useful for + joinable threads and is the value returned by Wait(). + This function is called by wxWidgets itself and should never be called + directly. + */ + virtual ExitCode Entry() = 0; + + /** + This is a protected function of the wxThread class and thus can only be called + from a derived class. It also can only be called in the context of this + thread, i.e. a thread can only exit from itself, not from another thread. + + This function will terminate the OS thread (i.e. stop the associated path of + execution) and also delete the associated C++ object for detached threads. + OnExit() will be called just before exiting. + */ + void Exit(ExitCode exitcode = 0); }; @@ -981,7 +983,7 @@ public: - wxSEMA_TIMEOUT: Timeout occurred without receiving semaphore. - wxSEMA_MISC_ERROR: Miscellaneous error. */ - wxSemaError WaitTimeout(unsigned longtimeout_millis); + wxSemaError WaitTimeout(unsigned long timeout_millis); };