aboutsummaryrefslogtreecommitdiff
path: root/lib/hook-functions.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/hook-functions.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/hook-functions.c b/lib/hook-functions.c
index fed9e3e..8363567 100644
--- a/lib/hook-functions.c
+++ b/lib/hook-functions.c
@@ -5,7 +5,9 @@
#include "transform-dis.h"
#include "execmem.h"
#include stringify(TARGET_DIR/jump-patch.h)
+#ifndef NO_PTHREADS
#include <pthread.h>
+#endif
struct hook_internal {
int offset_by_pcdiff[MAX_EXTENDED_PATCH_SIZE + 1];
@@ -135,9 +137,13 @@ int substitute_hook_functions(const struct substitute_function_hook *hooks,
size_t nhooks,
struct substitute_function_hook_record **recordp,
int options) {
+#ifndef NO_PTHREADS
bool thread_safe = !(options & SUBSTITUTE_NO_THREAD_SAFETY);
if (thread_safe && !pthread_main_np())
return SUBSTITUTE_ERR_NOT_ON_MAIN_THREAD;
+#else
+ bool thread_safe = false;
+#endif
if (recordp)
*recordp = NULL;