From a2142b2a5e1463965591c2fb48be95c7571b459e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Ned=C5=BEibovi=C4=87?= Date: Thu, 4 Mar 2021 11:57:18 +0100 Subject: [PATCH] Use pthread_self() instead of syscall(SYS_gettid). --- daemon/poller.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/daemon/poller.c b/daemon/poller.c index 98e9e831a..ee32a5e66 100644 --- a/daemon/poller.c +++ b/daemon/poller.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -67,18 +66,17 @@ struct poller_map *poller_map_new(void) { return p; } -long poller_map_add(struct poller_map *map) { - long tid = -1; +void poller_map_add(struct poller_map *map) { + pthread_t tid = -1; struct poller *p; if (!map) - return tid; - tid = syscall(SYS_gettid); + return; + tid = pthread_self(); mutex_lock(&map->lock); p = poller_new(); g_hash_table_insert(map->table, (gpointer)tid, p); mutex_unlock(&map->lock); - return tid; } struct poller *poller_map_get(struct poller_map *map) { @@ -86,7 +84,7 @@ struct poller *poller_map_get(struct poller_map *map) { return NULL; struct poller *p = NULL; - long tid = syscall(SYS_gettid); + pthread_t tid = pthread_self(); mutex_lock(&map->lock); p = g_hash_table_lookup(map->table, (gpointer)tid); if (!p) {