Boost logo

Boost :

From: John Panzer (jpanzer_at_[hidden])
Date: 2000-08-06 21:05:26


I work with multithreaded servers written in C and C++, primarily with
various pthreads implentations. Lack of multithread safety* in third-party
libraries is a big obstacle, and having a standard interface for avoiding
race conditions would help here. A standard interface with something as
low-level as a pthreads-style non-recursive mutex, augmented with a standard
mutex lock class to automate unlocking, would be useful and worthwhile. Not
that I'm arguing for this as the interface, just saying that it would be far
better than nothing.

On the separate topic of thread manipulation, it would be nice to be able to
write code that uses threads in a standard and portable way. If a standard
interface provided only the following, it would be useful:
- A way to create a thread, passing in arbitrary data in a type-safe way.
- A way to to end the current thread, analogous to exit() for the process.
- A way to get some unique identifier for the current thread.

I think that a procedural but type-safe interface would be fine for these
primitive operations. I'm pretty sure that, with the exception of some
debugging modules, all the thread manipulation code I've written could have
been created with only these primitives.

(Killing an arbitrary thread is IMHO a bad idea, since it almost by
definition leaves the program in an undefined state. Managing thread
priorities could be useful, but it's pretty system-dependent.)

I'd be happy to try to write up something less vague if there is any

-John Panzer

* In the sense of the SGI STL:

Boost list run by bdawes at, gregod at, cpdaniel at, john at