diff options
author | Mark H Weaver <mhw@netris.org> | 2013-11-17 04:00:29 -0500 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2013-11-23 14:39:51 -0500 |
commit | e676a4c34211efc8a7558afb0f8572b88a89c683 (patch) | |
tree | b28d19127e14d401629195012a8695dc3a224501 /libguile/async.h | |
parent | 1e42832af07ea6ac68ecbe4f6a3376ff509a2a51 (diff) | |
download | guile-e676a4c34211efc8a7558afb0f8572b88a89c683.tar.gz |
Add mutex locking functions that also block asyncs.
* libguile/async.h (scm_i_pthread_mutex_lock_block_asyncs,
scm_i_pthread_mutex_unlock_unblock_asyncs): New macros.
* libguile/threads.c (do_unlock_with_asyncs): New static helper.
(scm_i_dynwind_pthread_mutex_lock_block_asyncs): New function.
* libguile/threads.h (scm_i_dynwind_pthread_mutex_lock_block_asyncs):
Add prototype.
Diffstat (limited to 'libguile/async.h')
-rw-r--r-- | libguile/async.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libguile/async.h b/libguile/async.h index ceb2b960b..b3503de9a 100644 --- a/libguile/async.h +++ b/libguile/async.h @@ -78,6 +78,22 @@ SCM_API void scm_critical_section_end (void); scm_async_click (); \ } while (0) +# define scm_i_pthread_mutex_lock_block_asyncs(m) \ + do \ + { \ + SCM_I_CURRENT_THREAD->block_asyncs++; \ + scm_i_pthread_mutex_lock (m); \ + } \ + while (0) + +# define scm_i_pthread_mutex_unlock_unblock_asyncs(m) \ + do \ + { \ + scm_i_pthread_mutex_unlock (m); \ + SCM_I_CURRENT_THREAD->block_asyncs--; \ + } \ + while (0) + #else /* !BUILDING_LIBGUILE */ # define SCM_CRITICAL_SECTION_START scm_critical_section_start () |