summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorLongpeng(Mike)2022-02-22 10:05:05 +0100
committerPaolo Bonzini2022-04-06 14:31:56 +0200
commit657ac98b58cee10e99c9d402bda4555fd0ec4d1f (patch)
tree8b26f839c378811d1eacb346f09e464996bd53a4 /meson.build
parentthread-posix: remove the posix semaphore support (diff)
downloadqemu-657ac98b58cee10e99c9d402bda4555fd0ec4d1f.tar.gz
qemu-657ac98b58cee10e99c9d402bda4555fd0ec4d1f.tar.xz
qemu-657ac98b58cee10e99c9d402bda4555fd0ec4d1f.zip
thread-posix: use monotonic clock for QemuCond and QemuSemaphore
Use CLOCK_MONOTONIC, so the timeout isn't affected by changes to the system time. It depends on the pthread_condattr_setclock(), while some systems(e.g. mac os) does not support it, so the behavior won't change in these systems. Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com> Message-Id: <20220222090507.2028-3-longpeng2@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build11
1 files changed, 11 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 526e9dc03b..6ba60950c8 100644
--- a/meson.build
+++ b/meson.build
@@ -1780,6 +1780,17 @@ config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_TID', cc.links(gnu_source_pre
pthread_create(&thread, 0, f, 0);
return 0;
}''', dependencies: threads))
+config_host_data.set('CONFIG_PTHREAD_CONDATTR_SETCLOCK', cc.links(gnu_source_prefix + '''
+ #include <pthread.h>
+ #include <time.h>
+
+ int main(void)
+ {
+ pthread_condattr_t attr
+ pthread_condattr_init(&attr);
+ pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
+ return 0;
+ }''', dependencies: threads))
config_host_data.set('CONFIG_SIGNALFD', cc.links(gnu_source_prefix + '''
#include <sys/signalfd.h>