Operating System - HP-UX
1752793 Members
6096 Online
108789 Solutions
New Discussion юеВ

Re: where can I find pthread_attr_create() function?

 
SOLVED
Go to solution
jack_8
Contributor

where can I find pthread_attr_create() function?

I read materials "programming with threads on HP-UX" they use pthread_attr_create to create attribute object. but I can't find pthread_attr_create in my computer. I use hp11.0 and aCC 3.25. I have pthread lib and pthread.h on my machine. But I can find pthread_attr_create in pthread.h. I don't know where can I find pthread_attr_create() function?
2 REPLIES 2
Alex Glennie
Honored Contributor
Solution

Re: where can I find pthread_attr_create() function?

DCE Pthreads Package

On HP-UX 9.x, DCE pthreads provides the Reentrant C Library (libc_r.a),
the pthreads API based on POSIX.4a draft 4, the signal handling and the
exception handling support. Applications written to DCE Pthreads
link with libc_r.a and libpthreads.a. Applications that are multithreaded
should use cc_r for compiling threaded programs written to DCE pthreads.

On HP-UX 10.x and 11.0, improvements were made to libc so that the Reentrant
C Library (libc_r.a) and cc_r are no longer necessary (they are still
provided for backward compatibility reasons). Compilation and linking can be
accomplished by using the standard cc or c89 and libc.

This table provides a mapping between CMA threads functions and POSIX
threads functions with equivalent functionality. Consult the HP-UX man
pages for function prototype details.

CMA Name Available in POSIX Name
----------------------------------------------------------------------------
atfork libcma only pthread_atfork
hp__pthread_equal libcma only
pthread__cancel_thread libcma only pthread_cancel
pthread_attr_create libcma only pthread_attr_init
pthread_attr_delete libcma only pthread_attr_destroy
pthread_attr_getguardsize_np libcma only pthread_attr_getguardsize
pthread_attr_getinheritsched libcma only pthread_attr_getinheritsched
pthread_attr_getprio libcma only pthread_attr_getschedparam

It would appear they changed its name to pthread_attr_init if I'm interpreting the above correctly ?
Andy Bennett
Valued Contributor

Re: where can I find pthread_attr_create() function?

The book "programming with threads on HP-UX" doesn't apply to HP-UX 11.00's kernel threads which are the default. It is written, as Alex says, to describe the older DCE/CMA package (add flag -D_PTHREADS_DRAFT4 to the compile line and link with -lcma if you want this manual's APIs to appear). Have a look at "man pthread" on 11.00 to see some information about the new kernel threads package (link with -lpthread instead of -lcma for this).

HP's major document for kernel threads is the book mentioned at the end of "man pthread", "ThreadTime" by Norton and Dipasquale. Also, look at the appropriate compiler manuals since they usually have information about the flags to use when compiling for threads. It may also be worth checking out some of the other Unix vendors documentation websites since POSIX threads is pretty standard now and while there may be a few implementation differences between platforms the API descriptions will be relevant.