Implemented a draft of the resource control mechanism (still one global sync on a counter...)