Light-weight monitor implementation?

Bert Freudenberg bert at impara.de
Thu Nov 3 09:32:29 UTC 2005


Am 03.11.2005 um 08:49 schrieb Andreas Raab:

> 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"?

There is one relatively simple in Seaside:

	http://www.shaffer-consulting.com/david/Seaside/dandelionOutput/ 
Seaside-Utilities/WAProcessMonitor.html

Err, wait, that's not quite the code that is in my image - this one  
doesn't even use its timeout inst var? Actual code attached. But  
maybe you like the one above even better :)

- Bert

-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WAProcessMonitor.st.gz
Type: application/x-gzip
Size: 568 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20051103/8f876885/WAProcessMonitor.st.bin


More information about the Squeak-dev mailing list