Bug 175355 - Bad: Recursive Mutex in pthread.h
Summary: Bad: Recursive Mutex in pthread.h
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc
Version: 4.0
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-12-09 10:16 UTC by Raghuvamshi
Modified: 2007-11-30 22:07 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2005-12-09 12:02:12 UTC


Attachments (Terms of Use)

Description Raghuvamshi 2005-12-09 10:16:25 UTC
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 10:17:37 UTC
The problem could be due to the #ifdef in the pThread.h 

Comment 2 Jakub Jelinek 2005-12-09 12:02:12 UTC
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.