On Jan 6, 2008 9:30 AM, Andrew Coppin <[EMAIL PROTECTED]> wrote:
> 2. I have a situation where I have a thread generating some data and
> putting it into a mutable array, and another thread trying to read that
> data. Is there a way I can make the reader thread block if it tries to
> read a cell that hasn't been computed yet, but not introduce too much
> overhead for cells that have been filled in?

If your thread fills the array linearly, you could maintain a variable
shared by those threads that say the last cell computed, and have the
read thread check that before reading. I think this wouldn't create
too much overhead, although it seems like there must be something
cleverer somewhere.

-- 
Felipe.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to