diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/unix/thread_posix.cpp | 8 | ||||
-rw-r--r-- | drivers/unix/thread_posix.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index 03963a9756..2f9adb3f6c 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -77,6 +77,14 @@ void ThreadPosix::wait_to_finish_func_posix(Thread* p_thread) { tp->pthread=0; } +Error ThreadPosix::set_name(const String& p_name) { + + ERR_FAIL_COND_V(pthread == 0, ERR_UNCONFIGURED); + + int err = pthread_setname_np(pthread, p_name.utf8().get_data()); + + return err == 0 ? OK : ERR_INVALID_PARAMETER; +}; void ThreadPosix::make_default() { diff --git a/drivers/unix/thread_posix.h b/drivers/unix/thread_posix.h index 4f76f3d7b3..215da444e7 100644 --- a/drivers/unix/thread_posix.h +++ b/drivers/unix/thread_posix.h @@ -61,6 +61,7 @@ public: virtual ID get_ID() const; + Error set_name(const String& p_name); static void make_default(); |