[squeak-dev] Thread Safe Collections
Bill Schwab
BSchwab at anest.ufl.edu
Thu Apr 24 12:33:17 UTC 2008
Guille,
It took me a while to get comfortable with this position, but having
done things this way for a long time, I now think it is correct: the
explicitly thread-safe collection (SharedQueue, weak collections,
thread-safe dictionary-like classes) are a natural part of the thread
synchronization tools that happen to be useful as collections. They are
thread-safe because they need to be.
In general, I doubt you will help yourself very much by creating other
thread-safe collections, as there will still be operations that should
be atomic, and in the name of performance and avoiding a false sense of
security, "do it the hard way." Actually, it is not all that hard (most
of the time<g>). Over-protect with critical sections and then test:
deadlocks will reveal themselves particularly well in call-stacks for
all non-dead threads; dirty reads and writes are more trouble to find,
so when in doubt, protect; it is easy to let it deadlock and then back
off as appropriate. IMHO, trying to create a universal solution to
synchronization is a prescription for headaches.
Bill
Wilhelm K. Schwab, Ph.D.
University of Florida
Department of Anesthesiology
PO Box 100254
Gainesville, FL 32610-0254
Email: bschwab at anest.ufl.edu
Tel: (352) 846-1285
FAX: (352) 392-7029
More information about the Squeak-dev
mailing list
|