]> git.tdb.fi Git - libs/core.git/blob - source/core/unix/thread.cpp
Pthread_setname_np is a GNU extension
[libs/core.git] / source / core / unix / thread.cpp
1 #include <pthread.h>
2 #include <signal.h>
3 #include "thread.h"
4 #include "thread_private.h"
5
6 namespace Msp {
7
8 void Thread::platform_join()
9 {
10         pthread_join(priv_->handle, 0);
11 }
12
13 void Thread::platform_kill()
14 {
15         pthread_kill(priv_->handle, SIGKILL);
16 }
17
18 void Thread::platform_launch()
19 {
20         pthread_create(&priv_->handle, 0, &Private::main_wrapper, this);
21 }
22
23 void Thread::platform_setname()
24 {
25 #if defined(__GLIBC__) && (__GLIBC__>2 || (__GLIBC__==2 && __GLIBC_MINOR__>=12))
26         if(!name_.empty())
27                 pthread_setname_np(priv_->handle, name_.c_str());
28 #endif
29 }
30
31 } // namespace Msp