Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2001-11-28 22:40:13


I finally got a chance to look over the thread library a bit. Overall, it looks
like a nice start. Here are a couple of things I noticed.

1) First, on the Rationale page under the comparison of ref-based/versus
non-copyable design there is a bug in the code example:

5.
void foo()
{
   thread thrd* = new thread(&bar);
   manager.owns(thread); // oops should be thrd not thread!
}

2) Also, I found the "psuedo-code" section distracting. It was a little too
close to real C++ that when I missed the word "psuedo" I found myself wondering
what "thread = create_thread(&bar);" meant. Anyway, I finally went back and
understood, but at the end of the day, I think the psuedo code could be removed
and the documentation would be easier to read and just as illustrative.

3) In the xtime.html page under Example Usage the header link
(<boost/thread/xtime.hpp) actually links to tss.hpp.

4) Finally, I have a question about the time related interfaces. The current
Boost.threads requires the client to provide an "expiration time" (type
boost::xtime) for sleep and timed_locks. I was rather surprised that this
interface was not specified in terms of a time duration like:

  sleep(boost::time_duration)

where time_duration would hold the number of nano seconds to sleep. This would
be a more traditional interface to sleep and would remove the burden on client
programmers that need to "sleep for 2 seconds" from calling xtime_get and
performing addition to the xtime struct. Anyway, I was just curious about the
design motivations here.

Jeff


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