Commit | Line | Data |
---|---|---|
8f7887d6 LC |
1 | #ifndef SCM_GLTHREADS_H |
2 | #define SCM_GLTHREADS_H | |
3 | ||
4 | /* Copyright (C) 2014 Free Software Foundation, Inc. | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public License | |
8 | * as published by the Free Software Foundation; either version 3 of | |
9 | * the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
19 | * 02110-1301 USA | |
20 | */ | |
21 | ||
22 | /* This file implements Gnulib's glthreads/lock.h interface in terms of | |
23 | Guile's locking API. This allows Gnulib modules such as 'regex' to | |
24 | be built with thread-safety support via Guile's locks (see | |
25 | <http://bugs.gnu.org/14404>.) */ | |
26 | ||
27 | #include <libguile/threads.h> | |
5e69ceb7 MW |
28 | #include <stdlib.h> |
29 | ||
8f7887d6 LC |
30 | #define gl_lock_define(klass, name) \ |
31 | klass scm_i_pthread_mutex_t name; | |
5e69ceb7 | 32 | |
8f7887d6 LC |
33 | #define glthread_lock_init(lock) scm_i_pthread_mutex_init ((lock), NULL) |
34 | #define glthread_lock_destroy scm_i_pthread_mutex_destroy | |
35 | #define glthread_lock_lock scm_i_pthread_mutex_lock | |
36 | #define glthread_lock_unlock scm_i_pthread_mutex_unlock | |
5e69ceb7 MW |
37 | |
38 | #endif |