Switched to scoped lock in CBroker to make it exception safe

#258