[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9529.0. "pthread_key_t: long or int" by AXPBIZ::SIVA () Wed Apr 16 1997 22:31


Hi,


	In 4.0, we are getting compilation errors because of the conflicting
	typedefs for "pthread_key_t".


	In /usr/include/dce/pthread.h :

	dce/pthread.h:   typedef cma_t_key         pthread_key_t;


	where cma_t_key is defined as :

	dce/cma.h:       typedef unsigned long         cma_t_natural;
        dce/cma.h:       typedef       cma_t_natural   cma_t_key;


	Now the defintion of "pthread_key_t"  is "unsigned int" in
	/usr/include/sys/types.h and  in /usr/include/pthread.h.
	The defintion conflicts if one wants to include "types.h" as well as
	"cma.h".

	
	Any pointers/help to sort out this would be appreciated.


							thanks
							S i v a
T.RTitleUserPersonal
Name
DateLines
9529.1DCETHD::BUTENHOFDave Butenhof, DECthreadsThu Apr 17 1997 08:5416
How exactly are you compiling?

If you want to compile with the DCE thread definitions, you should be using
the -threads switch to cc. This causes cc to define _PTHREAD_USE_D4, which
causes <standards.h> to define _POSIX_C_SOURCE to 199309L rather than the
normal 199506L. Which, in turn, causes <sys/types.h> to skip definition of
all POSIX threads types, including the real pthread_key_t. (Which, as you've
observed, is different from the DCE thread type of the same name.)

The fact that you are able to get both definitions implies that you are not
using -threads, in which case you must define _PTHREAD_USE_D4 either on the
command line or in your source file prior to including any header file. (You
may also define _POSIX_C_SOURCE to 199309L [or lower] yourself, in addition:
But <standards.h> will take care of that, if you let it.)

	/dave