jackfirth / racket-disposable

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
Apache License 2.0
7 stars 0 forks source link

Add delayed deallocation wrapper #36

Closed jackfirth closed 7 years ago

jackfirth commented 7 years ago

By default, disposal deallocation happens immediately and blocks. Some resources however can be freed asynchronously without changing the semantics of a program using them. For such resources, a (disposable/delay <some-disposable>) wrapper could fire off a background thread to dispose the resource when disposal is required, allowing a program to not block on resource disposal. This should be decided per-disposable rather than per-use-site, because whether or not this is safe depends on the kind of resource produced.