Topic: ANSI/ISO C++ versus POSIX and threads


Author: Steve Clamage <stephen.clamage@Eng.Sun.COM>
Date: 1997/04/30
Raw View
tgibson@ibm.net wrote:
>
> We are working on a multi-threaded file system simulator.  The baseline
> work is almost complete.  We were planning on using the Pthreads package
> since it is available for several platforms.
>
> However, several packages commercial are out claiming to be "ANSI C++"
> compatible with "ANSI threads."
>
> +++++
> Can someone tell me the difference between ANSI and
> POSIX threads?  Specifically, if I use ANSI C++ threading,
> will it port over to POSIX threads?
> +++++

The C++ standard does not address threads or any form of multiprocessing
at all. There is no direct support in the language.

If a threads package claimed "ANSI C++ compatibility", it could only
mean the C++ code conformed to the draft standard. The implementation
and use of threads is completely outside the regimes of the C and C++
standards.

POSIX 1003.1c defines real-time threads, and POSIX standards are
routinely submitted to ISO and ANSI. So you could in principle refer to
"ANSI threads" as meaning POSIX threads. IMHO that would be pretty
sloppy, since some ANSI standard languages (like Ada) support threads
in their own way.

--
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: Ben Self <bself@opentext.com>
Date: 1997/05/03
Raw View

Steve Clamage:
>
> tgibson@ibm.net wrote:
> >
> > <snip> ...
> >
> > +++++
> > Can someone tell me the difference between ANSI and
> > POSIX threads?  Specifically, if I use ANSI C++ threading,
> > will it port over to POSIX threads?
> > +++++
>
>
> The C++ standard does not address threads or any form of multiprocessing
> at all. There is no direct support in the language.
>
> If a threads package claimed "ANSI C++ compatibility", it could only
> mean the C++ code conformed to the draft standard. The implementation
> and use of threads is completely outside the regimes of the C and C++
> standards.
>
> POSIX 1003.1c defines real-time threads
> <snip> ...

As stated C++ and POSIX 1003.1c have absolutely no formal association.
I diagree, however, in what ANSI C++ compatibility should mean for an
implementation of libpthread or a cooperating C++ compiler.  IMHO,
Threading should be safe from leaks or corruption when using exception
handling.  Also when a thread is explicitly canceled or exited it should
unwind the C++ call stack making sure that all destructors are called.

--ben


Ben R. Self
bself@opentext.com
www.opentext.com

Open Text -- home of Livelink Intranet
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: tgibson@ibm.net
Date: 1997/04/29
Raw View
We are working on a multi-threaded file system simulator.  The baseline
work is almost complete.  We were planning on using the Pthreads package
since it is available for several platforms.

However, several packages commercial are out claiming to be "ANSI C++"
compatible with "ANSI threads."

+++++
Can someone tell me the difference between ANSI and
POSIX threads?  Specifically, if I use ANSI C++ threading,
will it port over to POSIX threads?
+++++

We can use either Microsoft or Borland C++ (with ANSI standards)
or Gnu C++ and Pthreads.  I prefer to use the PC environment
because the IDE is better.  My faculty advisor loves FreeBSD
and Irix.

Thanks,

Tim Gibson
tgibso2@cs.umbc.edu
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]