Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* POSIX Threads and C++ with Tru64 CXX
@ 1999-07-28  4:00 Didier Donner
  1999-07-28  4:00 ` Ken Block USG
  0 siblings, 1 reply; 2+ messages in thread
From: Didier Donner @ 1999-07-28  4:00 UTC (permalink / raw)


Hello,

I am trying to compile C++ code with the POSIX 1003.1c
threads library. The C++ compiler is CXX 6.1-029 on a 4.0e Alpha.

The code is basically a set of C++ class which hides the variation in
implementation on variuous Unixes.
When I tried to compile this code
    int status = pthread_create(
        &thread_, NULL,
        &OSThreadImpl::thread_execute, (void*)this
    );

I get the following error
cxx: Error: threads.cc, line 679: no suitable constructor exists to convert
          from "long" to "CMA_T_HANDLE"
        &thread_, NULL,
------------------^

When I read the documentation for pthread_create, I got this
  int pthread_create(
              pthread_t             *thread,
              const pthread_attr_t  *attr,
              void *        (*start_routine)(void *),
              void          *arg);

According to the man pages, the attr parameter can be NULL.

Here are the compilations options.
cxx -c -o ../../../decunix4.0-cxx.shared.debug/threads.o  -ptr
../../../lib/decunix4.0-cxx.shared.debug/cxx_repository.utils
-threads   -g  -Ddec_unix -D__ANSI_CPP__ -DUSE_PTHREAD     -I/usr/include/cx
x  -I../../../include  threads.cc

Any help would be appreciated.

Thank you in advance,

Didier Donner






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

* Re: POSIX Threads and C++ with Tru64 CXX
  1999-07-28  4:00 POSIX Threads and C++ with Tru64 CXX Didier Donner
@ 1999-07-28  4:00 ` Ken Block USG
  0 siblings, 0 replies; 2+ messages in thread
From: Ken Block USG @ 1999-07-28  4:00 UTC (permalink / raw)
  To: Didier Donner

[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]

I don't believe you want to compile -threads, I think you want -pthread. The
following is from "man cxx":

  -pthread       Direct the linker to use the threadsafe version of any
                 library specified with the -l flag when linking programs.
                 This flag also tells the linker to include the POSIX
                 1003.1c-conformant DECthreads interfaces in libpthread when
                 linking the program.


  -threads       Direct the linker to use the thread-safe version of any
                 library specified with the -l flag when linking programs.
                 This flag also tells the linker to include both the DEC-
                 thread interfaces that are conformant with POSIX 1003.4a
                 Draft 4. The flag is supported only for compatability with
                 earlier releases of the operating system. New designs should
                 use the -pthread flag.


It is easy to reproduce what you are seeing:

cxxosf.zko.dec.com> cxx -c t.cxx -threads
cxx: Error: t.cxx, line 9: no suitable constructor exists to convert from
          "long" to "CMA_T_HANDLE"
        &thread_, NULL,
------------------^
cxx: Info: 1 error detected in the compilation of "t.cxx".


cxxosf.zko.dec.com> cxx -c t.cxx -pthread


cxxosf.zko.dec.com> cat t.cxx
#include <pthread.h>

void *func(void *) { return 0; }
pthread_t thread_;

void main()
{
    int status = pthread_create(
        &thread_, NULL,
        func, (void*)1
    );
}


[-- Attachment #2: Card for Kenneth Block --]
[-- Type: text/x-vcard, Size: 336 bytes --]

begin:          vcard
fn:             Kenneth Block
n:              Block;Kenneth
org:            CTG C/C++ Compiler
adr:            110 Spit Brook Road;;M/S ZKO3-2/W02;Nashua;NH;03062;USA
email;internet: block@zk3.dec.com
tel;work:       603-884-2819
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


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

end of thread, other threads:[~1999-07-28  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-07-28  4:00 POSIX Threads and C++ with Tru64 CXX Didier Donner
1999-07-28  4:00 ` Ken Block USG

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