An experimental Racket library providing an abstraction for values associated with external resources that allows automatic resource pooling, per-thread virtual construction, and monadic composition
There's too many different ways to automatically cleanup disposables for the name to be useful. The name acquire might make a good base name:
acquire! - renamed version of disposable-alloc!, unsafe building block
acquire-global - like autodispose, returns an instance of the disposable that lasts for the lifetime of the program (as determined by a plumber)
acquire-thread - returns an instance of the disposable that lasts for the lifetime of the current thread (a kill-safe manager running on a different thread will need to be used), could build virtual disposables on top of this using a shared manager
acquire-virtual - returns a thunk that maintains a mapping of threads to instances of the disposable and uses acquire-thread with a shared manager thread
There's too many different ways to automatically cleanup disposables for the name to be useful. The name
acquire
might make a good base name:acquire!
- renamed version ofdisposable-alloc!
, unsafe building blockacquire-global
- likeautodispose
, returns an instance of the disposable that lasts for the lifetime of the program (as determined by a plumber)acquire-thread
- returns an instance of the disposable that lasts for the lifetime of the current thread (a kill-safe manager running on a different thread will need to be used), could build virtual disposables on top of this using a shared manageracquire-virtual
- returns a thunk that maintains a mapping of threads to instances of the disposable and usesacquire-thread
with a shared manager thread