2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #ifndef _AFS_PTHREAD_GLOCK_H_
11 #define _AFS_PTHREAD_GLOCK_H_
13 #ifdef AFS_PTHREAD_ENV
15 #include <afs/afs_assert.h>
19 volatile pthread_t owner;
20 volatile unsigned int locked;
21 volatile unsigned int times_inside;
22 } pthread_recursive_mutex_t, *pthread_recursive_mutex_p;
24 #if defined(AFS_NT40_ENV) && defined(AFS_PTHREAD_ENV)
25 #ifndef AFS_GRMUTEX_DECLSPEC
26 #define AFS_GRMUTEX_DECLSPEC __declspec(dllimport) extern
29 #define AFS_GRMUTEX_DECLSPEC extern
32 AFS_GRMUTEX_DECLSPEC pthread_recursive_mutex_t grmutex;
34 extern int pthread_recursive_mutex_lock(pthread_recursive_mutex_p);
35 extern int pthread_recursive_mutex_unlock(pthread_recursive_mutex_p);
37 #define LOCK_GLOBAL_MUTEX \
38 osi_Assert(pthread_recursive_mutex_lock(&grmutex)==0)
40 #define UNLOCK_GLOBAL_MUTEX \
41 osi_Assert(pthread_recursive_mutex_unlock(&grmutex)==0)
45 #define LOCK_GLOBAL_MUTEX
46 #define UNLOCK_GLOBAL_MUTEX
48 #endif /* AFS_PTHREAD_ENV */
50 #endif /* _AFS_PTHREAD_GLOCK_H_ */