lock.h 1.4 KB

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