diff options
author | Ariel Manzur <ariel@godotengine.org> | 2015-12-17 06:24:27 -0300 |
---|---|---|
committer | Ariel Manzur <ariel@godotengine.org> | 2015-12-17 06:24:27 -0300 |
commit | 10298b9534937c8662fe6bea6dcf79457bd53970 (patch) | |
tree | f329c7c04aa20a5e6d1b3fd4a7d366bbf49842cc /drivers | |
parent | 6c3c20fc35cfe324a55409bd3d8fb0f0028774fe (diff) |
thread set name
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(); |