On 12 July 2011 20:53, Schwab,Wilhelm K <bschwab@anest.ufl.edu> wrote:
Sig,
Sounds good, with the possible exception of removing #remove:. Â Letting things happen is great, and giving the finalizer a recognizable name would be wonderful. Â Otherwise, one should be able to do explicit cleanup if desired[*]. Â Whether that applies to WeakRegistry, I'm not sure. Â I would want to be able to remove items from weak arrays, dictionaries, etc.
it only applies to weak registry.
[*] I am thinking of things like tight loops with database activity, etc. Â There have been times when I have had to explicitly clean up finaizable things, and cleaning the weak registrations at the same time always seemed reasonable.
yes, unless cleaning takes much more time than adding. Accessing weak registry is synchronized through semaphore. And for servers, where you expect to have high load on your image, the less critical sections you locking, the better.
Bill
________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Igor Stasenko [siguctua@gmail.com] Sent: Tuesday, July 12, 2011 10:13 AM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Socket objects created twice ?
On 12 July 2011 15:17, Schwab,Wilhelm K <bschwab@anest.ufl.edu> wrote:
Rather than changing the handle (making it harder to associate the handle with the "real" socket), it would be nicer to have a SocketFinalizer or something - it could even be a subclass of socket??
I just thought about it after posting previous mail. Yes it would be nice to add an explicit class, named SocketFinalizer and then add an inst var to Socket - a finalizer. Then when you deleting a socket, a socket could tell a finalizer to nil-out handle, instead of asking WeakRegistry to unregister the socket which is much slower. And a finalization action for nilled out handle will be no-op, once already closed socket become garbage.
In that way, someday we could eliminate the #remove: protocol from WeakRegistry.
-- Best regards, Igor Stasenko AKA sig.
-- Best regards, Igor Stasenko AKA sig.