Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2001-07-02 10:34:12


----- Original Message -----
From: <williamkempf_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, July 02, 2001 9:00 AM
Subject: [boost] Re: Boost.Threads - thread_desc concept

> void foo()
> {
> thread thrd(&bar);
> }

Question: can a thread run without a corresponding thread object?

If yes:
  - Non-copyable thread object interface is more efficient.
  - Less functionality. For example, running threads can't change their own
priority.

If no:
  - The above example won't do anything useful.
  - Thread object must be allocated on heap anyway in most cases, so the
'thread::ref' design is likely to be superior with no performance penalty in
most cases.
  - More functionality. A static function that returns a reference to the
currently running thread object is possible.
  - Overall clearer interface. If a thread object dies, the thread dies.
The inverse cannot be true, however: a thread may terminate long before it
is safe to destroy the thread object.

--
Rainer Deyke (root_at_[hidden])
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

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