using<T> method
T
using<T>(
- T resource,
- void releaseCallback(
- T
Registers resource
in this arena.
Executes releaseCallback
on releaseAll.
Returns resource
again, to allow for easily inserting
arena.using(resource, ...)
where the resource is allocated.
Implementation
T using<T>(T resource, void Function(T) releaseCallback) {
_ensureInUse();
releaseCallback = Zone.current.bindUnaryCallback(releaseCallback);
_managedResourceReleaseCallbacks.add(() => releaseCallback(resource));
return resource;
}