6 Miscellaneous Programming Features

6.4 The Resource Facility

A resource is a structure that keeps track of certain free objects so that they can be allocated to users. The Resource Facility is a means of avoiding the expense of consing or otherwise creating objects on demand by keeping track of objects as they are allocated and deallocated. The Resource Facility also is useful for managing the conditions that arise when multiple processes compete for the same resource, such as a value stored in a global variable.

The Resource Facility deals with isomorphic objects; that is, all objects in the resource must have the same form. Thus, any object in the resource can be allocated for any use, and there is no way to distinguish one object from another. For example, you can have a resource of 100-character strings, or a resource of strings of random lengths, but you cannot require a single resource to give you a string of some particular length.

The Resource Facility consists of the following constructs:

clear-resource
make-resource
resource-allocate
resource-deallocate
using-resource

6.4.1 - Resource examples
6.4.2 - Reference pages

The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker