summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/basic/hashmap.c11
-rw-r--r--src/basic/process-util.c9
-rw-r--r--src/basic/process-util.h2
-rw-r--r--src/basic/util.c9
-rw-r--r--src/basic/util.h2
5 files changed, 17 insertions, 16 deletions
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c
index 20e7e51d9e..015cc629b1 100644
--- a/src/basic/hashmap.c
+++ b/src/basic/hashmap.c
@@ -20,18 +20,19 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <stdlib.h>
#include <errno.h>
#include <pthread.h>
+#include <stdlib.h>
-#include "util.h"
#include "hashmap.h"
-#include "set.h"
#include "macro.h"
-#include "siphash24.h"
-#include "strv.h"
#include "mempool.h"
+#include "process-util.h"
#include "random-util.h"
+#include "set.h"
+#include "siphash24.h"
+#include "strv.h"
+#include "util.h"
#ifdef ENABLE_DEBUG_HASHMAP
#include "list.h"
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index e0061d15b3..c5d7dc3089 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -585,3 +585,12 @@ bool pid_is_alive(pid_t pid) {
return true;
}
+
+bool is_main_thread(void) {
+ static thread_local int cached = 0;
+
+ if (_unlikely_(cached == 0))
+ cached = getpid() == gettid() ? 1 : -1;
+
+ return cached > 0;
+}
diff --git a/src/basic/process-util.h b/src/basic/process-util.h
index 2c0d1af000..d17df5d81f 100644
--- a/src/basic/process-util.h
+++ b/src/basic/process-util.h
@@ -66,3 +66,5 @@ int getenv_for_pid(pid_t pid, const char *field, char **_value);
bool pid_is_alive(pid_t pid);
bool pid_is_unwaited(pid_t pid);
+
+bool is_main_thread(void);
diff --git a/src/basic/util.c b/src/basic/util.c
index b079e8af16..6fe4f47018 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -421,15 +421,6 @@ int glob_extend(char ***strv, const char *path) {
return k;
}
-bool is_main_thread(void) {
- static thread_local int cached = 0;
-
- if (_unlikely_(cached == 0))
- cached = getpid() == gettid() ? 1 : -1;
-
- return cached > 0;
-}
-
int block_get_whole_disk(dev_t d, dev_t *ret) {
char *p, *s;
int r;
diff --git a/src/basic/util.h b/src/basic/util.h
index e356f59cd5..96be6ecaa8 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -103,8 +103,6 @@ int socket_from_display(const char *display, char **path);
int glob_exists(const char *path);
int glob_extend(char ***strv, const char *path);
-bool is_main_thread(void);
-
int block_get_whole_disk(dev_t d, dev_t *ret);
#define NULSTR_FOREACH(i, l) \