1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

add pthread_atfork helpers to our threading shims

* libguile/null-threads.h:
* libguile/pthread-threads.h (SCM_DEFINE_ATFORK_HANDLERS_FOR_MUTEX)
  (scm_i_pthread_atfork): Define a pthread_atfork shim, and a helper to
  declare procedures to lock and unlock a mutex.

* libguile/threads.h (SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX): New macro,
  causes the snarfer to emit a pthread_atfork call to lock a mutex, if
  threads are enabled.
This commit is contained in:
Andy Wingo 2012-02-17 11:35:02 +01:00
parent f609480611
commit 2f745b64a1
3 changed files with 18 additions and 3 deletions

View file

@ -3,7 +3,7 @@
#ifndef SCM_NULL_THREADS_H
#define SCM_NULL_THREADS_H
/* Copyright (C) 2005, 2006, 2010 Free Software Foundation, Inc.
/* Copyright (C) 2005, 2006, 2010, 2012 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@ -102,6 +102,9 @@ SCM_API int scm_i_pthread_key_create (scm_i_pthread_key_t *key,
#define scm_i_scm_pthread_cond_wait scm_i_pthread_cond_wait
#define scm_i_scm_pthread_cond_timedwait scm_i_pthread_cond_timedwait
#define SCM_DEFINE_ATFORK_HANDLERS_FOR_MUTEX(m,lock,unlock) /* noop */
#define scm_i_pthread_atfork(pre,parent,child) do {} while (0)
#endif /* SCM_NULL_THREADS_H */