From 04ae0f340109a1e440d1afd2ae56f77812e2c6f3 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sat, 23 Oct 2010 00:47:29 +0200 Subject: [PATCH] New macros for handling the global lock --- src/h/internal.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/h/internal.h b/src/h/internal.h index 913211eac..a5d52bfba 100644 --- a/src/h/internal.h +++ b/src/h/internal.h @@ -315,6 +315,13 @@ extern void cl_write_object(cl_object x, cl_object stream); # define PACKAGE_OP_UNLOCK() THREAD_OP_UNLOCK() # define ERROR_HANDLER_LOCK() THREAD_OP_LOCK() # define ERROR_HANDLER_UNLOCK() THREAD_OP_UNLOCK() +# define ECL_WITH_GLOBAL_LOCK_BEGIN(the_env) \ + mp_get_lock_wait(cl_core.global_lock); \ + CL_UNWIND_PROTECT_BEGIN(the_env) +# define ECL_WITH_GLOBAL_LOCK_END \ + CL_UNWIND_PROTECT_EXIT { \ + mp_giveup_lock(cl_core.global_lock); \ + } CL_UNWIND_PROTECT_END #else # define HASH_TABLE_LOCK(h) # define HASH_TABLE_UNLOCK(h) @@ -322,6 +329,8 @@ extern void cl_write_object(cl_object x, cl_object stream); # define PACKAGE_OP_UNLOCK() # define ERROR_HANDLER_LOCK() # define ERROR_HANDLER_UNLOCK() +# define ECL_WITH_GLOBAL_LOCK_BEGIN(the_env) +# define ECL_WITH_GLOBAL_LOCK_END #endif /* ECL_THREADS */