3 ms·
> Taking an action that causes a finite resource (fds, memory, ports, etc.) to be allocated and used up is fundamentally different from just flipping a bit in a
by monocasa 5y ago
> Taking an action that causes a finite resource (fds, memory, ports, etc.) to be allocated and used up is fundamentally different from just flipping a bit in a resource that already exists.
The lock itself is the finite resource. Only one consumer can lock it at a time. And there are very much systems where semaphores are kernel objects that can run out (although they tend to be older systems that thankfully we've moved away from for the most part).
> Is automatic storage and block scopes conceptual baggage too then? I think that is only true if you reject the execution model that implies a stack.
RAII very much uses the stack model of functions and blocks at its core too; defer doesn't have a monopoly on that.