Implement tryTakeResource, tryWithResource