[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

pthreads_detach prototype?

» close window

The Question is:

 
the pthreads function pthreads_detach() doesn't seem to have the correct
prototype.
 
 


The Answer is :

> the pthreads function pthreads_detach() doesn't seem to have the correct
> prototype.
 
The proper function name is "pthread_detach()"; I presume that the error in the
note is a typo and not the actual source of the problem.
 
DECthreads offers three different source-level interfaces which provide a
pthread_detach().  Each of the three has a slightly different prototype.
 
If the customer could indicate which interface he is using (e.g., the name of
the header file containing the incorrect prototype), as well as why he thinks
it's incorrect, it would be much easier for us to explain what he is seeing.
 
However, I'll guess that it's one of two problems:
 
First, on V6.2 the file pthread.h defines the interface specified by Draft 4 of
the POSIX threads standard.  (Note that starting with V7, pthread.h provides the
final standard definitions; the Draft 4 definitions are found in pthread_d4.h.)
In this draft, pthread_detach() takes its argument by reference (to allow the
implementation to clear it, to avoid "dangling handle" problems).  However, in
the final standard specification, the routine signature was changed to pass the
pthread_t by value (since the caller is responsible for allocating the object).
If the customer is confused about whether he's programming to Draft 4 or the
final specification, that could result in his assertion that the prototype
declaration is incorrect.
 
Second, DECthreads provides two "flavors" of the Draft 4 interface.  The first,
as specified in the draft, reports errors by returning -1 and setting errno to
the error code.  The second reports errors by raising exceptions, a la the CMA
interface.  (Note that the final standard does neither -- it reports errors by
returning the errno code directly.)  In order to avoid problems resulting from
code expecting one error mechanism being built against the other interface, the
exception-reporting interface functions are declared as "returning void" where
the status-returning interface functions are declared as returning int's.  If
the customer is looking at pthread_exc.h instead of pthread.h, this might be the
source of his confusion.
 

answer written or last revised on ( 23-APR-1998 )

» close window