The current use of manual get_lock, release_lock calls is not exception safe, the with statement can be used to ensure exception safety

Registered by Martin Sandve Alnæs

This code will cause problems (e.g. deadlocks) in instant today:

lock = get_lock(...)
do_something() # raises exception
release_lock(lock) # not released

The with statement was introduced to python for precisely this reason, so we should make locking in instant work something like this:

with get_lock(...) as lock:
    do_something() # raises exception
# python inserts a call to lock.__exit__() or something here, allowing exception safe lock release

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Garth Wells

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.