Red Hat Bugzilla – Bug 59401
<pthread.h> cannot declare pthread_rwlock_t
Last modified: 2007-04-18 12:39:56 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i686)
Description of problem:
When attempting to compile a program declaring pthread_rwlock_t from <pthread.h>
gcc will issue an error and fail.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Obtain the program simple.c
2. Invoke gcc -c simple.c
Actual Results: Upon compilation gcc will issue the following error messages:
simple.c:16: parse error before 'rwlock'
simple.c:16: warning: data definition has no type or storage class
Expected Results: gcc should allow you to declare this type.
Without being able to declare this type you will not be able to utalize any of
the rwlock methods included in <pthread.h> as they all utalize a variable of
I am using glibc version 2.2.4-19.3.
This program will compile without error on Solaris.
Created attachment 44798 [details]
Very short program used to produce error.
pthread_rwlock_t is only available in Unix98 and later standards.
So, you need to choose such feature set if you want to use it.
One of -D_XOPEN_SOURCE=500, -D_XOPEN_SOURCE=600 or -D_GNU_SOURCE will do.
See info libc on "Feature Test Macros".