Operating System - HP-UX
1751695 Members
5054 Online
108781 Solutions
New Discussion юеВ

Compiling DCE/CMA Threads on HP-UX 11.0

 
SOLVED
Go to solution
Nareen Gurnani
Occasional Advisor

Compiling DCE/CMA Threads on HP-UX 11.0

I'm trying to compile DCE/CMA thread code on HP-UX 11.0 & getting the following errors:

Error 173: "/opt/dce/include/dce/pthread.h", line 173 # Redefined symbol 'pthread_attr_t'; previously defined at "/usr/include/sys/sigevent.h", line 40].
typedef cma_t_attr pthread_attr_t;

I'm using the following directives:
-D_REENTRANT -Aa -D_HPUX_SOURCE

Has anyone seen this error?
I'd appreciate any help I can get on this.
(By the way, I have no problems using POSIX threads on HP-UX 11.0)
6 REPLIES 6
Kenneth Platz
Esteemed Contributor

Re: Compiling DCE/CMA Threads on HP-UX 11.0

Nareen,

I seem to recall running into this problem awhile back, and it involved the order which certain files were #include'ed, but the detail escapes me. Would it be possible to post a piece of example code that illustrates the problem along with the command-line that you are using to compile it?

Thanks muchly!
I think, therefore I am... I think!
Nareen Gurnani
Occasional Advisor

Re: Compiling DCE/CMA Threads on HP-UX 11.0

Kenneth,
Here it is:
/opt/aCC/bin/aCC -I. -I/opt/sybase/include -I/opt/dce/include -I/opt/aCC/include -I/opt/aCC/include/iostream -I/opt/aCC/include/SC -I/watson/dev/src/common +inst_implicit_include -g0 -D_REENTRANT -Aa -D_HPUX_SOURCE -c main.cpp
Error 173: "/opt/dce/include/dce/pthread.h", line 173 # Redefined symbol
'pthread_attr_t'; previously defined at ["/usr/include/sys/sigevent.h", line 40].
typedef cma_t_attr pthread_attr_t;
^^^^^^^^^^^^^^
Error 173: "/opt/dce/include/dce/pthread.h", line 192 # Redefined symbol
'pthread_t'; previously defined at ["/usr/include/sys/signal.h", line 81].
typedef cma_t_thread pthread_t;
^^^^^^^^^
*** Error exit code 2
Stop.


Here is main.cpp:

#include
#include
#include
#include

long TestFn(long* iterations){ //do something...
return 0;
}
int main()
{ long thread_iter = 100000;
long rc1;
pthread_attr_t attr;
pthread_t thread1;
pthread_attr_create(&attr);
pthread_attr_setsched(&attr, SCHED_OTHER);
if (pthread_create(&thread1, attr,
(void *(*)(void*))TestFn,
&thread_iter)== -1)
{
cout << "Error on threading" << endl;
}
pthread_join(thread1, (void**)&rc1);
cout << "pthread_join(thread1): rc = " <<
rc1 << endl;
return 0;
} Thanks again,
Nareen
rick jones
Honored Contributor

Re: Compiling DCE/CMA Threads on HP-UX 11.0

dont get me wrong, but if you have no problems with the "real" (as it were) POSIX threads on 11, why are you even bothering to try and use the CMA/DCE threads?

even on 11, CMA/DCE threads will not scale with processors

something compiled on 11 cannot be run on 10.20

so, it seems that it would make the most sense to just move forward and use the POSIX threads. one exception i suppose would be if you still need 10.20 support in the same source files
there is no rest for the wicked yet the virtuous have no pillows
Nareen Gurnani
Occasional Advisor

Re: Compiling DCE/CMA Threads on HP-UX 11.0

The reason is that we have vendor libraries that are using DCE/CMA threads, but have not been migrated to POSIX threads yet.
Kenneth Platz
Esteemed Contributor
Solution

Re: Compiling DCE/CMA Threads on HP-UX 11.0

Nareen:

Try #include (instead of , but add the "-D_PTHREADS_DRAFT4" to your compile line. The /usr/include/pthread.h file has conditionals in there to select CMA versus POSIX draft 10 threads.

I hope this helps.
I think, therefore I am... I think!
Nareen Gurnani
Occasional Advisor

Re: Compiling DCE/CMA Threads on HP-UX 11.0

Kenneth,
That did it.
Thanks a lot,
Nareen