From adc786d034b63176b941a1ef8d996acbf8d0ea5d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 29 Nov 2017 20:22:06 +0100 Subject: core: Unify syscall_clamp functions. * src/estream.c (_gpgrt_set_syscall_clamp) (_gpgrt_get_syscall_clamp): Move to ... * src/syscall-clamp.c: new file. (_gpgrt_pre_syscall, _gpgrt_post_syscall): New. * src/Makefile.am (libgpg_error_la_SOURCES): Add that file. * src/estream.c: Replace the syscall wrapper with the new functions. * src/posix-lock.c: Ditto. * src/w32-lock.c: Ditto. * src/posix-thread.c: Ditto. * src/w32-thread.c: Ditto. Signed-off-by: Werner Koch --- src/w32-thread.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'src/w32-thread.c') diff --git a/src/w32-thread.c b/src/w32-thread.c index aef421f..c389635 100644 --- a/src/w32-thread.c +++ b/src/w32-thread.c @@ -29,38 +29,18 @@ #include #include #include -#include #define WIN32_LEAN_AND_MEAN #include +#include "gpgrt-int.h" #include "thread.h" -/* - * Functions called before and after blocking syscalls. - * gpgrt_set_syscall_clamp is used to set them. - */ -static void (*pre_syscall_func)(void); -static void (*post_syscall_func)(void); - - -/* Helper to set the clamp functions. This is called as a helper from - * _gpgrt_set_syscall_clamp to keep the function pointers local. */ -void -_gpgrt_thread_set_syscall_clamp (void (*pre)(void), void (*post)(void)) -{ - pre_syscall_func = pre; - post_syscall_func = post; -} - - gpg_err_code_t _gpgrt_yield (void) { - if (pre_syscall_func) - pre_syscall_func (); + _gpgrt_pre_syscall (); Sleep (0); - if (post_syscall_func) - post_syscall_func (); + _gpgrt_post_syscall (); return 0; } -- cgit v1.2.3