From 5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Wed, 21 Jan 2026 22:40:55 +0100 Subject: Add Redis source code for testing --- .../redis-unstable/deps/jemalloc/test/src/sleep.c | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/redis-unstable/deps/jemalloc/test/src/sleep.c (limited to 'examples/redis-unstable/deps/jemalloc/test/src/sleep.c') diff --git a/examples/redis-unstable/deps/jemalloc/test/src/sleep.c b/examples/redis-unstable/deps/jemalloc/test/src/sleep.c new file mode 100644 index 0000000..2234b4b --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/src/sleep.c @@ -0,0 +1,27 @@ +#include "test/jemalloc_test.h" + +/* + * Sleep for approximately ns nanoseconds. No lower *nor* upper bound on sleep + * time is guaranteed. + */ +void +sleep_ns(unsigned ns) { + assert(ns <= 1000*1000*1000); + +#ifdef _WIN32 + Sleep(ns / 1000 / 1000); +#else + { + struct timespec timeout; + + if (ns < 1000*1000*1000) { + timeout.tv_sec = 0; + timeout.tv_nsec = ns; + } else { + timeout.tv_sec = 1; + timeout.tv_nsec = 0; + } + nanosleep(&timeout, NULL); + } +#endif +} -- cgit v1.2.3