1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 08:40:19 +02:00

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.
This commit is contained in:
Mark H Weaver 2013-11-17 04:00:29 -05:00
parent 1e42832af0
commit e676a4c342
3 changed files with 33 additions and 0 deletions

View file

@ -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 ()