Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 2000-08-04 18:34:14


Dietmar Kuehl wrote:

> - What happens to platforms which don't have threading support,

Is there any system where threads cannot be implemented ? Any
hosted system ?

> ie. are
> threads important enough to make optional standard components?

Clearly yes.

> - What is the impact on programs not needing multi threading support?

None

> - How do exceptions and threads interact. For example what happens if
> two threads throw exceptions at the same time?

Given:

brick-/tmp $ cat except.cc
#include <iostream>
#include <unistd.h>

int main ()
{
  try {
    struct T {
      ~T () { sleep (2); }
    } x;
    std::cout << "Will throw now.\n";
    throw 0;
  } catch (int) {
    std::cout << "Catched !\n";
  }
}
brick-/tmp $ g++ except.cc

What happens in the following case:

brick-/tmp $ ./a.out & ./a.out
[1] 15688
Will throw now.
Will throw now.
Catched !
[1] + done ./a.out
Catched !
brick-/tmp $

Answer: nothing special.

The standard library has to be somewhat MT-compatible to write
any MT code !

> Now, currently we are not discussing to bring this stuff into the C++
> standard (Boost is *not* a workgroup of WG21).

Are you sure of that ? I thought it was !

> we
> should also come up with sample uses of threads where threads are
> indeed an advantage over other techniques - without any hand waving!

Do you mean that we should find typical use patterns and design
an interface for those rather than trying to determine what
kind of mutex is the most elementary (which makes no sens in
general) and build everything on top of it ? If so then I can't
agree more, but we shouldn't even have to mention such obvious things.

-- 
Valentin Bonnard

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk