Boost logo

Boost :

From: Joel Salomon (spamm_trapp_at_[hidden])
Date: 2004-09-06 16:59:37


John Torjo wrote:
> Use mutexes.
and
> In my experience, I hardly need just a container to be thead-safe. I
> usually need more data in addition to the container (which needs to be
> thread-safe). For instance, an extra latest_access_time, out_file,
> used_for_the_first_time, etc.
>
> Thus, to me, the benefit of having a thread-safe container is very small.
>
One thread-safe container that might be useful is a channel - a queue
that one thread writes to and another reads to, the reader blocking when
the channel is empty. Inferno and Plan9 (and the port of the plan 9
thread library to Unix) use these for thread control as well as for
inter-thread communication. Supposedly multithreaded programs based on
the channel are easier to write correctly or prove correct.

--Joel


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