[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
__USE_UNIX98 to enable late pthread features
From: |
John Calcote |
Subject: |
__USE_UNIX98 to enable late pthread features |
Date: |
Mon, 23 Aug 2010 11:28:55 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 |
Hi all,
I ran into an interesting issue today. Hoping some of you have some
insight for me. I needed to use a later addition to the pthreads spec -
pthread_mutexaddr_settype (in order to initialize a recursive mutex). To
use this function, you need to define __USE_UNIX98 before including
pthread.h - at least on my platform (opensuse 11.3 64-bit).
I was trying to figure out how to get Autoconf-generated configure
scripts to define this macro for me if it was needed. The truth,
however, is that if I need UNIX98 functionality, and it's not available
on a platform, configure needs to fail (at least in my case).
Because the library actually provides the function, but it's not
"enabled" in pthread.h, AC_CHECK_FUNCS is succeeding without issue
(which I would expect, because of the way it's designed to look for
library exports, and not header file entries), but the compiler is
complaining that the function is being used without a prototype (which
is completely true if __USE_UNIX98 is not defined).
What is the correct approach for this situation? Should I simply define
__USE_UNIX98 in my source code because I need the associated
functionality? Is __USE_UNIX98 a widely used and understood macro?
(Google searches didn't really help me understand the proper use of this
macro.)
TIA,
John
- __USE_UNIX98 to enable late pthread features,
John Calcote <=