Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the simple-finalizer Reference Manual, version 0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 15:02:15 2020 GMT+0.
• Introduction | What simple-finalizer is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
-*- mode: org -*- * INTRODUCTION This is the README for SIMPLE-FINALIZER, a package that wraps the finalizer functionality provided by TRIVIAL-GARBAGE and CFFI. SIMPLE-FINALIZER depends on TRIVIAL-GARBAGE and CFFI. ASDF packaging is provided; (asdf:oos 'asdf:load-op :simple-finalizer) After loading the system, try the following example; (make-instance 'simfin:foreign-object :fp (cffi:foreign-alloc :char :count 20)) (simfin:gc-p *) (simfin:free **) * DESCRIPTION Simple-finalizer manages the deletion of a foreign object by implementing a wrapper object that contains both the foreign-object and the function to free the foreign object. The foreign object may be deleted explictly by calling FREE, or automatically when the object is finalized (at time of garbage collection). Use MAKE-INSTANCE to create a new FOREIGN-OBJECT, as show below. (make-instance 'simfin:foreign-object :fp:free :gc ) FOREIGN-OBJECT wraps the foreign object stored in FP. The foreign object is finalized when the wrapper is garbage collected using the function in :FREE and :GC is T. FP returns a reference to the foreign object or NIL if the object has already been deleted using FREE. (simfin:FP *obj*) The object can be explicitely freed using FREE. Once freed, the reference to the foreign object as well as the deletion function are set to NIL. Attempting to enable finalization on a previously deleted foreign object will result in an error. (simfin:FREE *obj*) GC-P will return T if the object will be deleted at finalization/garbage collection. Returns NIL if the foreign object was previously deleted or if the foreign object must be freed manually using FREE. (simfin:GC-P *obj*) FREE-P returns T if the foreign object was previously freed (simfin:FREE-P *obj*) Object deletion at finalization is enabled or disabled by setting GC-P to T or NIL, as follows; (SETF (GC-P *obj*) T) ; Enable finalization (SETF (GC-P *obj*) NIL) ; Disable finalization THIS-FP a reference to the foreign object. Unlike FP which can be overridden by a subclass, THIS-FP must never be overridden and must always point to the foreign object. An important point to note is that the function passed in :FREE does not act as an object 'destructor' in the C++ or Java sense because there are no destructors in Common Lisp. :FREE is not called when FOREIGN-OBJECT goes out of scope, but rather when the LISP object is being garbage collected. Another point to note is that by the time the function in :FREE is called, the CLOS slots for the object will already have been garbage-collected. Comments, criticisms, additions, and optimizations are welcome at the email address below. Luke Crook luke@balooga.com
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The simple-finalizer system |
Luke Crook <luke@balooga.com>
Luke Crook <luke@balooga.com>
BSD
A simple Common Lisp finalizer for foreign objects when using CFFI and TRIVIAL-GARBAGE.
0.1
simple-finalizer.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The simple-finalizer.asd file | ||
• The simple-finalizer/package.lisp file | ||
• The simple-finalizer/simple-finalizer.lisp file |
Next: The simple-finalizer/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
simple-finalizer.asd
simple-finalizer (system)
Next: The simple-finalizer/simple-finalizer․lisp file, Previous: The simple-finalizer․asd file, Up: Lisp files [Contents][Index]
simple-finalizer (system)
package.lisp
Previous: The simple-finalizer/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
simple-finalizer (system)
simple-finalizer.lisp
simple-free (function)
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The simple-finalizer-system package | ||
• The simple-finalizer package |
Next: The simple-finalizer package, Previous: Packages, Up: Packages [Contents][Index]
simple-finalizer.asd
Previous: The simple-finalizer-system package, Up: Packages [Contents][Index]
package.lisp (file)
simfin
common-lisp
simple-free (function)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported generic functions | ||
• Exported classes |
Next: Exported classes, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Returns the foreign object reference.
simple-finalizer.lisp (file)
An explicit cleanup method. When freed, ‘GC-P‘ will be NIL.
simple-finalizer.lisp (file)
Returns ‘T if the foreign object was previously deleted using ‘FREE‘.
simple-finalizer.lisp (file)
(setf gc-p) (generic function)
Returns ‘T‘ if the foreign object will be finalized.
simple-finalizer.lisp (file)
Enables or disables finalization.
simple-finalizer.lisp (file)
gc-p (generic function)
Returns the foreign object reference. This method may not be redefined by a subclass.
simple-finalizer.lisp (file)
Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
A wrapper around the foreign object stored in ‘FP‘.
Finalizes the foreign object using the function in ‘:FREE‘ when ‘GC-P‘ is ‘T‘ when the wrapper is garbage collected.
The foreign object is explicitely freed by calling ‘FREE‘.
simple-finalizer.lisp (file)
standard-object (class)
Returns the foreign object reference.
:fp
(error ":fp must not be nil.")
fp (generic function)
Returns ‘T‘ if the foreign object will be finalized.
:gc
t
gc-p (generic function)
:free
(function cffi-sys:foreign-free)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal functions |
Previous: Internal definitions, Up: Internal definitions [Contents][Index]
simple-finalizer.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L S |
---|
Jump to: | F L S |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
F G M S T |
---|
Jump to: | (
F G M S T |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | F G S |
---|
Jump to: | F G S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C F P S |
---|
Jump to: | C F P S |
---|