]> git.tdb.fi Git - libs/core.git/blob - source/core/unix/thread.cpp
1ddcaaea4bcf947a50fb411f0991a86b8b47def9
[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