[previous] [up] [next]     [contents] [index]
Next: Miscellaneous Utilities Up: Custodians Previous: Custodians

Library Functions

Scheme_Manager *scheme_make_manager(Scheme_Manager *m) 

Creates a new custodian as a subordinate of m. If m is NULL, then the current custodian is used as the new custodian's supervisor.

Scheme_Manager_Reference *scheme_add_managed( Scheme_Manager *m, Scheme_Object *o, 
                          Scheme_Close_Manager_Client *f, void *data, 
                          int strong) 

Places the value o into the management of the custodian m. The f function is called by the custodian if it is ever asked to ``shutdown'' its values; o and data are passed on to f, which has the type

typedef void (*Scheme_Close_Manager_Client)(Scheme_Object *o, void *data);

If strong is non-zero, then the newly managed value will be remembered until either the custodian shuts it down or scheme_remove_managed is called. If strong is zero, the value is allowed to be garbaged collected (and automatically removed from the custodian).

The return value from scheme_add_managed can be used to refer to the value's custodian later in a call to scheme_remove_managed. A value can be registered with at most one custodian.

void scheme_remove_managed( Scheme_Manager_Reference *mref, Scheme_Object *o) 

Removes o from the management of its custodian. The mref argument must be a value returned by scheme_add_managed.

void scheme_close_managed( Scheme_Manager *m) 

Instructs the custodian m to shutdown all of its managed values.



PLT