diff options
Diffstat (limited to 'src/w32-thread.c')
-rw-r--r-- | src/w32-thread.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/w32-thread.c b/src/w32-thread.c index 6860075..aef421f 100644 --- a/src/w32-thread.c +++ b/src/w32-thread.c @@ -35,10 +35,32 @@ #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 (); Sleep (0); + if (post_syscall_func) + post_syscall_func (); return 0; } |