chickadee » timed-resource » make-timed-resource

make-timed-resource OPENER CLOSER TIMEOUT #!optional NAMEprocedure

Returns a new timed-resource object that covers a resource with a lifetime of TIMEOUT seconds. The resource is acquired by the OPENER and released by the CLOSER. The acquired resource will be released automatically at the end of its' life.

During shutdown returns #f.

OPENER
(procedure () *) ; returns the resource-object
CLOSER
(procedure (*)) ; takes the resource-object (returned by OPENER)
TIMEOUT
number ; seconds
NAME
* ; prefix for the gensym of the created timed-resource

No attempt is made to serialize access to a resource, this is up to the caller; just don't share the thing.

Exceptions occurring during resource acquisition or release abort the operation. Exceptions during resource release at shutdown are just displayed but no further action is taken.