From b0cf9efa6afeb8a7dbddf124dae173a2d633c801 Mon Sep 17 00:00:00 2001 From: rpj Date: Fri, 1 Oct 2004 07:17:09 +0000 Subject: Mutex speedups --- tests/benchlib.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests/benchlib.c') diff --git a/tests/benchlib.c b/tests/benchlib.c index 78ec3c8..3fa7171 100644 --- a/tests/benchlib.c +++ b/tests/benchlib.c @@ -51,6 +51,31 @@ int old_mutex_use = OLD_WIN32CS; BOOL (WINAPI *ptw32_try_enter_critical_section)(LPCRITICAL_SECTION) = NULL; HINSTANCE ptw32_h_kernel32; +void +dummy_call(int * a) +{ +} + +void +interlocked_inc_with_conditionals(int * a) +{ + if (a != NULL) + if (InterlockedIncrement((long *) a) == -1) + { + *a = 0; + } +} + +void +interlocked_dec_with_conditionals(int * a) +{ + if (a != NULL) + if (InterlockedDecrement((long *) a) == -1) + { + *a = 0; + } +} + int old_mutex_init(old_mutex_t *mutex, const old_mutexattr_t *attr) { -- cgit v1.2.3