afishbeck/HPCC-Platform — comment on commit e8eb99f805aa49e4ef4a8f606195324254bc0a23
File: esp/services/ws_workunits/ws_workunitsService.cpp line 1083
By richardkchapman:

Personally I think int his case the clear() is ok (though I would comment on it to indicate why it is important that it happens where it does).

The local scope is fine for making sure no leaks but doesn;t really help readers of the code understand WHY the scope needs to be restricted as it is. We are used to seeing local scopes restricting the duration of a CritSec - and we know why we have to do that - but the lock here is implicit so less obvious. If you just add the scope some future editor may think it's pointless and remove it. The clear is less likely to be removed, but with a comment would be better still.