diff options
author | Ariel Manzur <ariel@okamstudio.com> | 2016-01-31 20:22:38 -0300 |
---|---|---|
committer | Ariel Manzur <ariel@okamstudio.com> | 2016-01-31 20:23:24 -0300 |
commit | 0cd8c054a2070a9b91505d5f3a9addfe131352f1 (patch) | |
tree | 27118161c7a4dd8fe88c6a99e7bacceaa71be80d /core/os | |
parent | b406aae790fe8f4cf331fa7fac629b418a674754 (diff) |
thread renaming
Diffstat (limited to 'core/os')
-rw-r--r-- | core/os/thread.cpp | 4 | ||||
-rw-r--r-- | core/os/thread.h | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/core/os/thread.cpp b/core/os/thread.cpp index 7fb1e969d4..f5d984876d 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -32,6 +32,7 @@ Thread* (*Thread::create_func)(ThreadCreateCallback,void *,const Settings&)=NULL; Thread::ID (*Thread::get_thread_ID_func)()=NULL; void (*Thread::wait_to_finish_func)(Thread*)=NULL; +Error (*Thread::set_name_func)(const String&)=NULL; Thread::ID Thread::_main_thread_id=0; @@ -60,6 +61,9 @@ void Thread::wait_to_finish(Thread *p_thread) { Error Thread::set_name(const String &p_name) { + if (set_name_func) + return set_name_func(p_name); + return ERR_UNAVAILABLE; }; diff --git a/core/os/thread.h b/core/os/thread.h index 5711561809..4fead72b94 100644 --- a/core/os/thread.h +++ b/core/os/thread.h @@ -63,6 +63,7 @@ protected: static Thread* (*create_func)(ThreadCreateCallback p_callback,void *,const Settings&); static ID (*get_thread_ID_func)(); static void (*wait_to_finish_func)(Thread*); + static Error (*set_name_func)(const String&); friend class Main; @@ -73,10 +74,9 @@ protected: public: - virtual Error set_name(const String& p_name); - virtual ID get_ID() const=0; - + + static Error set_name(const String &p_name); _FORCE_INLINE_ static ID get_main_ID() { return _main_thread_id; } ///< get the ID of the main thread static ID get_caller_ID(); ///< get the ID of the caller function ID static void wait_to_finish(Thread *p_thread); ///< waits until thread is finished, and deallocates it. |