From d4c5e599f3ad3ef88690c53dfd83ae80eabed8b9 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 9 May 2011 04:27:04 +0200 Subject: [PATCH] Define API for test threading helpers --- test/task.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/task.h b/test/task.h index 206ed93a..a190f324 100644 --- a/test/task.h +++ b/test/task.h @@ -23,6 +23,7 @@ #define TASK_H_ +#include #include #include @@ -46,8 +47,8 @@ } while (0) -/* - * Have our own assert, so we are sure it does not get optimized away in + +/* Have our own assert, so we are sure it does not get optimized away in * a release build. */ #define ASSERT(expr) \ @@ -73,4 +74,16 @@ #define HELPER_IMPL(name) \ int run_helper_##name() + +/* Create a thread. Returns the thread identifier, or 0 on failure. */ +uintptr_t oio_create_thread(void (*entry)(void* arg), void* arg); + +/* Wait for a thread to terminate. Should return 0 if the thread ended, -1 on + * error. + */ +int oio_wait_thread(uintptr_t thread_id); + +/* Pause the calling thread for a number of milliseconds. */ +void oio_sleep(int msec); + #endif /* TASK_H_ */