1 |
/* rwlock type. Generic version. |
/* rwlock type. Generic version. |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002, 2005 Free Software Foundation, Inc. |
3 |
This file is part of the GNU C Library. |
This file is part of the GNU C Library. |
4 |
|
|
5 |
The GNU C Library is free software; you can redistribute it and/or |
The GNU C Library is free software; you can redistribute it and/or |
40 |
|
|
41 |
/* Initializer for a rwlock. */ |
/* Initializer for a rwlock. */ |
42 |
#define __PTHREAD_RWLOCK_INITIALIZER \ |
#define __PTHREAD_RWLOCK_INITIALIZER \ |
43 |
((struct __pthread_rwlock) \ |
{ __SPIN_LOCK_INITIALIZER, __SPIN_LOCK_INITIALIZER, 0, 0, 0, 0, 0 } |
|
{ __SPIN_LOCK_INITIALIZER, __SPIN_LOCK_INITIALIZER, 0, 0, 0, 0, 0 }) |
|
44 |
|
|
45 |
|
|
46 |
_EXTERN_INLINE int |
_EXTERN_INLINE int |
47 |
pthread_rwlock_init (struct __pthread_rwlock *__rwlock, |
pthread_rwlock_init (struct __pthread_rwlock *__rwlock, |
48 |
const struct __pthread_rwlockattr *__attr) |
const struct __pthread_rwlockattr *__attr) |
49 |
{ |
{ |
50 |
|
struct __pthread_rwlock initialized_rwlock = __PTHREAD_RWLOCK_INITIALIZER; |
51 |
extern int _pthread_rwlock_init (struct __pthread_rwlock *, |
extern int _pthread_rwlock_init (struct __pthread_rwlock *, |
52 |
const struct __pthread_rwlockattr *); |
const struct __pthread_rwlockattr *); |
53 |
|
|
54 |
if (__attr) |
if (__attr) |
55 |
return _pthread_rwlock_init (__rwlock, __attr); |
return _pthread_rwlock_init (__rwlock, __attr); |
56 |
|
|
57 |
*__rwlock = __PTHREAD_RWLOCK_INITIALIZER; |
*__rwlock = initialized_rwlock; |
58 |
return 0; |
return 0; |
59 |
} |
} |
60 |
|
|