Light-weight monitor implementation?

Andreas Raab andreas.raab at gmx.de
Fri Nov 4 04:03:29 UTC 2005


Folks -

Based on the discussion I decided to leave Monitor alone and rather 
build trivial Mutex (2 methods) and MutexSet (3 methods) 
implementations. It does everything I need and if anyone else is 
interested it's available at:

     http://bugs.impara.de/view.php?id=2154

Cheers,
   - Andreas

Andreas Raab wrote:
> 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"?
> 
> Cheers,
>   - Andreas
> 
> 




More information about the Squeak-dev mailing list