Finalization question

John M McIntosh johnmci at smalltalkconsulting.com
Wed Jun 14 17:39:51 UTC 2006


I'll also note MPEGFile uses the same pattern which was copied from  
the Socket code originally.
This pattern of code is used in other class I've written, (6 more in  
Sophie) and if someone can find a bug in
it this pattern of code would be interesting to know.

I'll note if your code does cleanup processing as part of an explicit  
method send, then in the finalize
method you may need a guard clause to prevent double usage of destroy  
logic (which might cause problem).



On 14-Jun-06, at 10:13 AM, David Shaffer wrote:

> Did you ever sort this out Dave?  Looking at StandardFileStream I see
> exactly the pattern you describe:
>
> unregister method removes the file stream from the registry via
> remove:ifAbsent:
>
> close sends unregister
>
> It seems odd that your race condition occurs but I've never had such a
> problem with file streams.  Further investigation shows that Socket  
> does
> the same thing.  Maybe you could look at them and see where your usage
> differs.  Is the problem Squeak version dependent?  I've looked over
> WeakRegistry in 3.7 and it looks solid.  No obvious race
> conditions...but they are never obvious, are they ;-)
>
> David
>
>

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list