Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Dec Unix 4.0B and threads
@ 1997-05-01  4:00 Dilip Dasilva
  1997-05-02  4:00 ` Chris Cebelenski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dilip Dasilva @ 1997-05-01  4:00 UTC (permalink / raw)




 Hi,

 I am trying to compile a program that uses threads on Dec Unix 4.0B
 that compiled without a problem on Dec Unix 3.2.

 It uses posix threads so I have the following include file

   #include <pthread.h>

 The problem is that these files are different between 4.0B and 3.2.
 The 4.0B file does not contain the definitions for pthread_startroutine_t
 and pthread__addr_t .  These definitions are included in
 /usr/include/pthread_exc.h. I noticed that there are two pthread.h
 include files - one in /usr/include/pthread.h and the other in 
 /usr/include/dce/pthread.h . On 3.2 one of these files was
 a linked to the other.

  Does anyone know which include files I need to get my program to
  compile on 4.0B. 

 Thanks, Dilip



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Dec Unix 4.0B and threads
  1997-05-01  4:00 Dec Unix 4.0B and threads Dilip Dasilva
  1997-05-02  4:00 ` Chris Cebelenski
@ 1997-05-02  4:00 ` Peter Sanger
  1997-05-05  4:00 ` Dave Butenhof
  2 siblings, 0 replies; 6+ messages in thread
From: Peter Sanger @ 1997-05-02  4:00 UTC (permalink / raw)
  To: Dilip Dasilva


Dilip Dasilva wrote:
> 
>  Hi,
> 
>  I am trying to compile a program that uses threads on Dec Unix 4.0B
>  that compiled without a problem on Dec Unix 3.2.
> 
>  It uses posix threads so I have the following include file
> 
>    #include <pthread.h>
> 
>  The problem is that these files are different between 4.0B and 3.2.
>  The 4.0B file does not contain the definitions for pthread_startroutine_t
>  and pthread__addr_t .  These definitions are included in
>  /usr/include/pthread_exc.h. I noticed that there are two pthread.h
>  include files - one in /usr/include/pthread.h and the other in
>  /usr/include/dce/pthread.h . On 3.2 one of these files was
>  a linked to the other.
> 
>   Does anyone know which include files I need to get my program to
>   compile on 4.0B.
> 
>  Thanks, Dilip

3.2 uses Posix threads that are based on the draft for the Posix threads
standard. Dec Unix 4.0 uses a Pthread library that is based on the final
Posix thread standard. Unfortunately, there are a number of differences
between the draft and the final standard, and you will probably have to
make a number of changes in your thread handling code.

For a discussion of the differences between the draft and final standard
see e.g. "Pthreads Programming" by Bradford Nichols e.a., O'reilly.
(http://www.ora.com/catalog/pthread/noframes.html)

Peter

-- 
Peter Sanger                     E-mail: peter.sanger@mailbox.swipnet.se
Karlhovsvagen 17                 Phone:  +46 8 55069514
15137 Sodertalje, Sverige        Fax:    +46 8 55069514



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Dec Unix 4.0B and threads
  1997-05-01  4:00 Dec Unix 4.0B and threads Dilip Dasilva
@ 1997-05-02  4:00 ` Chris Cebelenski
  1997-05-02  4:00 ` Peter Sanger
  1997-05-05  4:00 ` Dave Butenhof
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Cebelenski @ 1997-05-02  4:00 UTC (permalink / raw)



Dilip, I'm just about to embark upon this journey myself.  My understanding is
that DU3.2 has the v4 rev of the POSIX pthreads, and that DU has the new full
release of the standard (1003.c? can't remember.)  The two are different in
several siginificant ways and you would have to port to use the newer standard
(which i recommend anyway.)  Hope this helps.

Chris




dilip@best.com (Dilip Dasilva) wrote:
>
> Hi,
>
> I am trying to compile a program that uses threads on Dec Unix 4.0B
> that compiled without a problem on Dec Unix 3.2.
>
> It uses posix threads so I have the following include file
>
>   #include <pthread.h>
>
> The problem is that these files are different between 4.0B and 3.2.
> The 4.0B file does not contain the definitions for pthread_startroutine_t
> and pthread__addr_t .  These definitions are included in
> /usr/include/pthread_exc.h. I noticed that there are two pthread.h
> include files - one in /usr/include/pthread.h and the other in 
> /usr/include/dce/pthread.h . On 3.2 one of these files was
> a linked to the other.
>
>  Does anyone know which include files I need to get my program to
>  compile on 4.0B. 
>
> Thanks, Dilip




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Dec Unix 4.0B and threads
  1997-05-01  4:00 Dec Unix 4.0B and threads Dilip Dasilva
  1997-05-02  4:00 ` Chris Cebelenski
  1997-05-02  4:00 ` Peter Sanger
@ 1997-05-05  4:00 ` Dave Butenhof
  1997-05-05  4:00   ` Brian O'Neill
  2 siblings, 1 reply; 6+ messages in thread
From: Dave Butenhof @ 1997-05-05  4:00 UTC (permalink / raw)




Dilip Dasilva wrote:
> 
>  Hi,
> 
>  I am trying to compile a program that uses threads on Dec Unix 4.0B
>  that compiled without a problem on Dec Unix 3.2.
> 
>  It uses posix threads so I have the following include file
> 
>    #include <pthread.h>
> 
>  The problem is that these files are different between 4.0B and 3.2.
>  The 4.0B file does not contain the definitions for pthread_startroutine_t
>  and pthread__addr_t .  These definitions are included in
>  /usr/include/pthread_exc.h. I noticed that there are two pthread.h
>  include files - one in /usr/include/pthread.h and the other in
>  /usr/include/dce/pthread.h . On 3.2 one of these files was
>  a linked to the other.

DEC OSF/1 3.2 did not have POSIX threads. It had "DCE threads", a
partial implementation of the ancient and obsolete DRAFT 4 of the
document that would eventually evolve into the POSIX standard. Draft 4
would have been forgotten (and deservedly so) in December of 1990, when
it was superceded by draft 5 -- except that the Open Software Foundation
wanted "standard" threads for DCE and chose unwisely to use something
that WASN'T a standard to meet that desire.

Artifacts like pthread_addr_t and pthread_startroutine_t are worse,
since they're not even from the draft standard -- they're pure DCE
thread hacks. In fact, the exist only because we had to deal with old,
non-ANSI C compilers, (as well as some buggy compilers that claimed to
support ANSI C), that didn't work well with "void *". The pseudo-type
pthread_addr_t is nothing more than "void *", and pthread_startroutine_t
is just "void *(*)(void*)". Except that, on platforms where that would
have been unacceptable to the compiler (and now, over 6 years later,
there should no longer be any such archaic compilers!), the headers
would substitute "char *" for "void *". The private DCE types hid that
messiness.

>   Does anyone know which include files I need to get my program to
>   compile on 4.0B.

The fact that your code isn't building on 4.0 almost certainly means
that you were building incorrectly on 3.2. You should be compiling and
linking using "cc -threads". That was the only supported way to build
threaded code on 3.2, and had you used it you'd have seen no change on
4.0. But if you're intent on doing it yourself, on 4.0 you need to add
the definition -D_PTHREAD_USE_D4 to the cc command. (Of course you're
already compiling with -D_REENTRANT and linking with "-lpthreads -lmach
-lc_r" at the end of the list of libraries and in exactly that order,
right? Now, to link DCE thread code on 4.0, you need to use "-lpthreads
-lpthread -lmach -lexc", in exactly that order.)

The root of the problem is that OSF chose to illicitly use a draft
standard as if it were a real standard. Inevitably, the standard
changed, and OSF didn't. We've tried to provide as much compatibility
for Digital UNIX 4.0 as possible, but we're limited by the reality that
DCE threads isn't, and never was, a standard, and POSIX threads IS a
standard. Where they conflict (and that's MANY places, including the
name of the header file), POSIX threads IS the only rule, and we will
not sacrifice POSIX conformance for DCE hackery.

The pthread_exc.h header, by the way, is something else entirely -- it
defines a variant of the DCE thread interfaces that report all errors by
raising exceptions rather than by returning error numbers (as in POSIX
threads) or setting errno and returning -1 (as in DCE threads). This is
the interface that was used by most DCE code, since exceptions are a
much more reliable way to deal with errors in threaded code. That's
pretty much unchanged, since POSIX threads has no pthread_exc.h. The
definitions for the "pseudo-standard" DCE thread interfaces have been
relegated to /usr/include/dce/pthread_d4.h. Including <pthread.h>,
however, with _PTHREAD_USE_D4 defined, will "chain" to
<dce/pthread_d4.h>, defining a compatible DCE thread environment,
including pthread_addr_t and pthread_startroutine_t.

/---[ Dave Butenhof ]-----------------------[ butenhof@zko.dec.com ]---\
| Digital Equipment Corporation           110 Spit Brook Rd ZKO2-3/Q18 |
| 603.881.2218, FAX 603.881.0120                  Nashua NH 03062-2698 |
\-----------------[ Better Living Through Concurrency ]----------------/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Dec Unix 4.0B and threads
  1997-05-05  4:00 ` Dave Butenhof
@ 1997-05-05  4:00   ` Brian O'Neill
  1997-05-06  4:00     ` Peter Sanger
  0 siblings, 1 reply; 6+ messages in thread
From: Brian O'Neill @ 1997-05-05  4:00 UTC (permalink / raw)



Since we're on  the subject, has anyone seen "unkillable" threaded
processes under 4.0B? We have users doing simulations using the POSIX
threads, and occasionally we get processes which cannot be killed, they
just sit in the CPU and spin endlessly...

-- 
======================================================================
Brian O'Neill - Director of Computing, Computer Science (508) 934-3645
University of Massachusetts Lowell         <*>       oneill@cs.uml.edu
"My God man...we've become a tourist attraction..." - Londo, Babylon-5



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Dec Unix 4.0B and threads
  1997-05-05  4:00   ` Brian O'Neill
@ 1997-05-06  4:00     ` Peter Sanger
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Sanger @ 1997-05-06  4:00 UTC (permalink / raw)



Brian O'Neill wrote:
> 
> Since we're on  the subject, has anyone seen "unkillable" threaded
> processes under 4.0B? We have users doing simulations using the POSIX
> threads, and occasionally we get processes which cannot be killed, they
> just sit in the CPU and spin endlessly...
> 
One way to create them is to run a threaded application from a debugger.
Then terminate the debugger without first stopping the program ...


Peter
-- 
Peter Sanger                     E-mail: peter.sanger@mailbox.swipnet.se
Karlhovsvagen 17                 Phone:  +46 8 55069514
15137 Sodertalje, Sverige        Fax:    +46 8 55069514



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1997-05-06  4:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-05-01  4:00 Dec Unix 4.0B and threads Dilip Dasilva
1997-05-02  4:00 ` Chris Cebelenski
1997-05-02  4:00 ` Peter Sanger
1997-05-05  4:00 ` Dave Butenhof
1997-05-05  4:00   ` Brian O'Neill
1997-05-06  4:00     ` Peter Sanger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox