mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 17:20:29 +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:
parent
f609480611
commit
2f745b64a1
3 changed files with 18 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
|||
#ifndef SCM_THREADS_H
|
||||
#define SCM_THREADS_H
|
||||
|
||||
/* Copyright (C) 1996,1997,1998,2000,2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996,1997,1998,2000,2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2011, 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
|
||||
|
@ -130,6 +130,10 @@ typedef struct scm_i_thread {
|
|||
#define SCM_VALIDATE_CONDVAR(pos, a) \
|
||||
scm_assert_smob_type (scm_tc16_condvar, (a))
|
||||
|
||||
#define SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX(m) \
|
||||
SCM_SNARF_HERE(SCM_DEFINE_ATFORK_HANDLERS_FOR_MUTEX(&m,lock_##m,unlock_##m))\
|
||||
SCM_SNARF_INIT(scm_i_pthread_atfork (lock_##m, unlock_##m, unlock_##m);)
|
||||
|
||||
SCM_API SCM scm_spawn_thread (scm_t_catch_body body, void *body_data,
|
||||
scm_t_catch_handler handler, void *handler_data);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue