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. An acquired resource will be released automatically at the end of its' life.

The OPENER is a (procedure () *) returning the resource object.

The CLOSER is a (procedure (*)) taking a resource object returned by the OPENER.

The NAME is used as a prefix for the generated unique identifier of the created timed-resource and is usually a string or symbol. There is no semantic content.

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.