Resource HANDLES and the handling of such handles #22
svenssonjoel
started this conversation in
Ideas
Replies: 1 comment
-
Think of a resource (on the C side) as a struct with these fields and potentially others more id, payload-ptr, act-on-gc-fptr, init-fptr , ... , next next encodes the list structure of resources. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Some times LBM programs may use things that are initialized and managed on the C side (arrays, drivers etc)
Handles are an encapsulation of a resource, It cannot be looked into or operated on by standard LBM, but it transfers knowledge between different extensions.
One idea is to add a HANDLE type to LBM that is just an integer (with some specific type bits). The lifetime of the handle is managed by the garbage collector (who calls a resource-manager-callback).
On the C side a resource handler needs to manage a datastructure (list or tree or whatever) of resources.
C gives to LBM a callback or set of callbacks (depending on direction one wants to take).
A specific resource handler is free to divide the set of handles into special and general-use handles.
Callbacks:
The callbacks are the interface for LBM and extensions to interface with the HANDLE and its lifetime.
Beta Was this translation helpful? Give feedback.
All reactions