Bug 175355 - Bad: Recursive Mutex in pthread.h
Bad: Recursive Mutex in pthread.h
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc (Show other bugs)
4.0
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-12-09 05:16 EST by Raghuvamshi
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-12-09 07:02:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Raghuvamshi 2005-12-09 05:16:25 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050921 Red Hat/1.0.7-1.4.1 Firefox/1.0.7

Description of problem:
We are using recursive mutex in my application
	
        pthread_mutexattr_t attr;
	(void)pthread_mutexattr_init(&attr);
	(void)pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE);
        (void)pthread_mutex_init(mutex,&attr);
	(void)pthread_mutexattr_destroy(&attr);
and are encountering constant problems with compilation due to `PTHREAD_MUTEX_RECURSIVE' undeclared (first use in this function)
warning: implicit declaration of function `pthread_mutexattr_settype'
warning: nested extern declaration of `pthread_mutexattr_settype'

We are not able to comile the application with recursive mutex even when we have included the required pthread.h libarary file

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.Simple program using recursive Mutex
2.Compilation 
3.
  

Actual Results:  Not able to comile, getting repeated error regarding to 
`PTHREAD_MUTEX_RECURSIVE' undeclared (first use in this function)
warning: implicit declaration of function `pthread_mutexattr_settype'
warning: nested extern declaration of `pthread_mutexattr_settype'


Additional info:
Comment 1 Raghuvamshi 2005-12-09 05:17:37 EST
The problem could be due to the #ifdef in the pThread.h 
Comment 2 Jakub Jelinek 2005-12-09 07:02:12 EST
Please see
info libc 'Feature Test Macros'
In particular, PTHREAD_MUTEX_RECURSIVE is a Unix98 and newer POSIX macro,
so you need one of
-D_XOPEN_SOURCE=500
-D_XOPEN_SOURCE=600
-D_GNU_SOURCE
on the compiler command line to enable that namespace.

Note You need to log in before you can comment on or make changes to this bug.