implement locking inside broctl library

this seems to trigger 'removing stale lock' and not actually work..