diff --git a/Makefile.in b/Makefile.in index d923d507..24ab5421 100644 --- a/Makefile.in +++ b/Makefile.in @@ -167,7 +167,7 @@ DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.3) DOCS := $(DOCS_HTML) $(DOCS_MAN3) C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \ $(srcroot)test/src/btalloc_1.c $(srcroot)test/src/math.c \ - $(srcroot)test/src/mtx.c $(srcroot)test/src/mq.c \ + $(srcroot)test/src/mtx.c $(srcroot)test/src/sleep.c \ $(srcroot)test/src/SFMT.c $(srcroot)test/src/test.c \ $(srcroot)test/src/thd.c $(srcroot)test/src/timer.c ifeq (1, $(link_whole_archive)) diff --git a/test/include/test/jemalloc_test.h.in b/test/include/test/jemalloc_test.h.in index c46af5d9..a59408fc 100644 --- a/test/include/test/jemalloc_test.h.in +++ b/test/include/test/jemalloc_test.h.in @@ -124,6 +124,7 @@ static const bool config_debug = #include "test/math.h" #include "test/mtx.h" #include "test/mq.h" +#include "test/sleep.h" #include "test/test.h" #include "test/timer.h" #include "test/thd.h" diff --git a/test/include/test/mq.h b/test/include/test/mq.h index af2c078d..5dc6486c 100644 --- a/test/include/test/mq.h +++ b/test/include/test/mq.h @@ -1,4 +1,4 @@ -void mq_nanosleep(unsigned ns); +#include "test/sleep.h" /* * Simple templated message queue implementation that relies on only mutexes for @@ -82,7 +82,7 @@ a_prefix##get(a_mq_type *mq) { \ \ ns = 1; \ while (true) { \ - mq_nanosleep(ns); \ + sleep_ns(ns); \ msg = a_prefix##tryget(mq); \ if (msg != NULL) { \ return msg; \ diff --git a/test/include/test/sleep.h b/test/include/test/sleep.h new file mode 100644 index 00000000..c232f633 --- /dev/null +++ b/test/include/test/sleep.h @@ -0,0 +1 @@ +void sleep_ns(unsigned ns); diff --git a/test/src/mq.c b/test/src/sleep.c similarity index 89% rename from test/src/mq.c rename to test/src/sleep.c index 9b5f672d..2234b4bc 100644 --- a/test/src/mq.c +++ b/test/src/sleep.c @@ -5,11 +5,11 @@ * time is guaranteed. */ void -mq_nanosleep(unsigned ns) { +sleep_ns(unsigned ns) { assert(ns <= 1000*1000*1000); #ifdef _WIN32 - Sleep(ns / 1000); + Sleep(ns / 1000 / 1000); #else { struct timespec timeout;