lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, 2005-02-16 at 05:52, Ben Sunshine-Hill wrote:
> Apologies if I'm missing something obvious, but under this patch, what
> features are in place to prevent resource leaks with a C function that
> allows yielding after having locked a resource, and then is never
> resumed (thread is GCed)? Obviously, one could stick a userdata on the
> stack with a custom __gc for cleanup, but is there a less roundabout
> way?

Consider a resource manager task
which uses a weak table, and if the owner of a
resource is found to be dead, release the resource.

First order solution might deadlock if there are
dependencies.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net