Skip to content
Snippets Groups Projects
Commit 2fceca73 authored by Florian Fischer's avatar Florian Fischer
Browse files

[Runtime] use gettid() if provided by libc

parent 829b9529
No related branches found
No related tags found
1 merge request!238Consume liburing as meson wrap if native is not recent enough
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
// Non portable. // Non portable.
#include <sched.h> // for cpu_set_t, CPU_SET, CPU_ZERO #include <sched.h> // for cpu_set_t, CPU_SET, CPU_ZERO
#include <sys/sysinfo.h> // for get_nprocs #include <sys/sysinfo.h> // for get_nprocs
#include <unistd.h>
#include <cstdlib> // for rand, srand, abort #include <cstdlib> // for rand, srand, abort
#include <cstring> #include <cstring>
...@@ -48,8 +49,10 @@ ...@@ -48,8 +49,10 @@
#include <urcu.h> // for rcu_register_thread #include <urcu.h> // for rcu_register_thread
#endif #endif
#include <syscall.h> // for SYS_gettid #ifndef EMPER_HAS_GETTID
#include <unistd.h> // for syscall #include <syscall.h>
#define gettid() (syscall(SYS_gettid))
#endif
std::mutex Runtime::currentRuntimeMutex; std::mutex Runtime::currentRuntimeMutex;
Runtime* Runtime::currentRuntime; Runtime* Runtime::currentRuntime;
...@@ -249,7 +252,7 @@ auto Runtime::workerLoop(Worker* worker) -> void* { ...@@ -249,7 +252,7 @@ auto Runtime::workerLoop(Worker* worker) -> void* {
workerIo->setWorkerIo(worker); workerIo->setWorkerIo(worker);
} }
LOGD("Worker loop started by thread " << syscall(SYS_gettid)); LOGD("Worker loop started by thread " << gettid());
int oldType; int oldType;
errno = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldType); errno = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldType);
......
cpp_has_gettid = cpp_compiler.has_function('gettid', prefix: '#include<unistd.h>')
conf_data.set('EMPER_HAS_GETTID', cpp_has_gettid)
emper_asm_sources = [ 'ContextAsm.nasm' ] emper_asm_sources = [ 'ContextAsm.nasm' ]
nasm = find_program('nasm') nasm = find_program('nasm')
# mesons's nasm support currently means using generator() # mesons's nasm support currently means using generator()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment