Boost logo

Boost :

Subject: Re: [boost] request for interest in a garbage collection library
From: Beman Dawes (bdawes_at_[hidden])
Date: 2009-04-17 10:10:41


On Fri, Apr 17, 2009 at 4:08 AM, Achilleas Margaritis <axilmar_at_[hidden]> wrote:
>> I think the question David was asking is; if a GC object is holding a
>> mutex that is currently holding a lock, then when does that lock
>> release, or how does that lock release? The GC may run in the future,
>> and in the meanwhile, that lock is frozen.
>>
>
> Aren't scoped locks a better way to handle such issues? The big advantage of
> C++ is scoped construction/destruction.

Achilleas, you are missing Dave and Sid's point. It is a common and
very appropriate programming practice to place resources like files
and mutexes in an object and to dynamically allocate that object. If
GC is used to reclaim the containing that object, then sub-objects it
contains like mutexes or files that release on destruction may not get
released soon enough. You need to address this concern. Telling folks
not to place non-memory resources in types that may be dynamically
allocated isn't likely to fly.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk