X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gnulib%2Flock.c;h=73cdc411d235780cbef2bf8cef873bf54a660497;hb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;hp=34a59ab33910d6219c37b8d04df4c6bcf02d7d7b;hpb=fb2bd066c2f8b34addafe48d62550e3033a59431;p=debian%2Famanda diff --git a/gnulib/lock.c b/gnulib/lock.c index 34a59ab..73cdc41 100644 --- a/gnulib/lock.c +++ b/gnulib/lock.c @@ -1,9 +1,9 @@ /* Locking in multithreaded situations. - Copyright (C) 2005-2006 Free Software Foundation, Inc. + Copyright (C) 2005-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -250,7 +250,24 @@ glthread_rwlock_destroy (gl_rwlock_t *lock) # if HAVE_PTHREAD_MUTEX_RECURSIVE -# if !(defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) +# if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + +void +glthread_recursive_lock_init (gl_recursive_lock_t *lock) +{ + pthread_mutexattr_t attributes; + + if (pthread_mutexattr_init (&attributes) != 0) + abort (); + if (pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE) != 0) + abort (); + if (pthread_mutex_init (lock, &attributes) != 0) + abort (); + if (pthread_mutexattr_destroy (&attributes) != 0) + abort (); +} + +# else void glthread_recursive_lock_init (gl_recursive_lock_t *lock)