Improved locking: use raise instead of abort, create lock before update_code
Merge pull request #3 from giosh94mhz/master

Improved locking: use raise instead of abort, create lock before update_...