Re: Multitasking and containers



Matthew Heaney wrote:
"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> writes:

Write your own container. Parallel systems require delicate handmade work.

Horrible advice. Just declare the container inside a protect object, and
manipulate the container by calling protected procedures. Works great...

Not at all, even for sequential systems. Standard libraries are necessarily compromises among various concerns such as safety, performance, ease of use, and so on. Specific projects may, and sometimes will, have requirements that are not met by such libraries. In such cases, custom versions are needed.

In this case, we may have an instance of premature optimization; the OP seems to be worrying about the overhead of wrapping a container in a protected object without any evidence that this approach won't meet the project's requirements (indeed, it seems there is no project and no specific requirements are involved). In that case, it probably will "work great". But in specific cases a custom version that does allow unprotected multiple readers may be required.

--
Jeff Carter
"There's no messiah here. There's a mess all right, but no messiah."
Monty Python's Life of Brian
84
.