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

Conference clt::cma

Title:DECthreads Conference
Moderator:PTHRED::MARYSTEON
Created:Mon May 14 1990
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1553
Total number of notes:9541

1534.0. "pthread_d4.h" by CSC32::J_HENSON (Don't get even, get ahead!) Tue Apr 29 1997 18:32

OpenVMS V7.0, Dec C V5.5-003, Alpha

Can someone explain how the pthread_d4.h include file should be used,
or where it's use is documented?

I just had a call from a customer trying to call pthread_attr_create
and some other pthread routines.  He was including pthread.h.  On
the compile, he got the %cc-i-implicitfnc message telling him that
pthread_attr_create was implicitly declared.  The link failed
with an undefined symbol because it couldn't find pthread_attr_create.

After fumbling around for a while, I discovered that if I include
pthread_d4.h instead of pthread.h, everything compiles and links
fine (don't know about execution).  Is this what we should be using
instead of pthread.h?

Thanks,

Jerry
U.S. CSC
T.RTitleUserPersonal
Name
DateLines
1534.1Use 1003.1c interface for new codePTHRED::MARYSMary Sullivan, DECthreads EngineeringTue Apr 29 1997 19:5156
Well, given neither Webb nor Dave are currently around to answer this
thoroughly, I'll have a got at..

Prior to V7.0, <pthread.h> defined the draft 4 of the (then) proposed
POSIX threads standard.  A final standard was passed, 1003.1c, which
was implemented by DECthreads in OpenVMS V7.0.  The standard mandated
that that interface be defined in <pthread.h>.  Since there was (and
still is) a fair amount of existing code coded against draft 4 of the
standard, a new header <pthread_d4.h> was created for use by applications
until they could migrate their code to use the 1003.1c interface.

From the commentary in <pthread.h>:

 * NOTICE: Temporary support for POSIX 1003.4a/D4 migration
 * --------------------------------------------------------
 *
 * Support 1003.4a/D4 ("DCE threads") source migration mode by allowing
 * programmer to cause #include <pthread.h> to define the old interfaces
 * (with modified names) if the _PTHREAD_USE_D4 macro is defined. This is
 * equivalent to #include <pthread_d4.h> -- the remainder of this header
 * file is not processed.
 *
 * In practice, you can invoke the source migration mode either by the
 * following sequence within your .c or .h files:
 *
 *      #define _PTHREAD_USE_D4
 *      #include <pthread.h>
 *
 * or by modifying your Makefile (or manual build sequence) to use the -D
 * compiler (or cpp) option:
 *
 *      cc -D_PTHREAD_USE_D4 foo.c
 *
 * The POSIX 1003.4a/D4 migration support will be retired (this clause will
 * be removed from pthread.h!) in the next major release of each operating
 * system (OpenVMS VAX, OpenVMS Alpha, and Digital UNIX) that occurs at least
 * one year after the initial release of the POSIX 1003.1c interfaces in
 * Digital UNIX 4.0 and OpenVMS 7.0.
 *

Hmmm..  We should probably reword the "will be retired" clause since the one
year mark has come and gone for both UNIX/VMS.  But that's a discussion for
another note (1517.*).  ;-)

So if your customer has an existing application coded against the D4 
interface which he is trying to rebuild on OpenVMS V7.0, he can either
include <pthread_d4.h> directly, or compile his code:

$ CC/DEFINE=(_PTHREAD_USE_D4) FOO.C

If your customer is writing *new* threaded code, he shouldn't be
writing against the old standard.  With the standard implementation,
he should use the routine pthread_attr_init.  Does he have a copy
of the Guide to DECthreads revised for V7.n?

-Mary
1534.2DCETHD::BUTENHOFDave Butenhof, DECthreadsWed Apr 30 1997 08:4811
This is much more convenient on Digital UNIX, and essentially transparent for
old makefiles that were built according to the rules. The cc compiler
"driver" supported the "-threads" switch, which was the documented way to
build code that used the DCE thread or CMA interfaces. When we released POSIX
thread support in Digital UNIX 4.0, we added "-D_PTHREAD_USE_D4" to -threads
and created a new -pthread switch to build POSIX thread code.

Unfortunately, the VMS cc command never had any direct thread support, so
there's no way to avoid changing something.

	/dave
1534.3ThanksCSC32::J_HENSONDon&#039;t get even, get ahead!Wed Apr 30 1997 12:470