Light-weight monitor implementation?

Andreas Raab andreas.raab at
Thu Nov 3 07:49:57 UTC 2005

Hi Folks,

I was looking for a simple monitor implementation (e.g., a mechanism for 
mutual exclusion which allows the same process to enter it multiple 
times) and looked at the implementation of Monitor that is present in 
3.9. Much to my surprise, I found that this monitor implementation is a 
very heavyweight version of what should essentially be three methods, 
e.g., #enter, #leave, and #critical:. The extra heavy-weight behavior 
might be useful in certain specific cases but I wonder about its general 
applicability (personally I find it more confusing than helpful because 
it hides the nature of a monitor under a lot of extra baggage). I think 
it would be tremendously useful to do a little refactoring which a) 
makes a tiny class Monitor and b) makes a heavy-weight EventMonitor 
which has all the extra stuff (timeout, events) that is now in Monitor.

What do other people think? Is there any reason for Monitor being such a 
heavy-weight object by default? Is it necessary that a monitor support 
all of the extra functionality besides the basic "allow a process to 
enter it multiple times"?

   - Andreas

More information about the Squeak-dev mailing list