Fix locking
This commit is contained in:
parent
3929922f49
commit
a8366fe00f
20
garage.py
20
garage.py
|
@ -36,39 +36,27 @@ def main():
|
|||
|
||||
|
||||
def eastDoorOpened():
|
||||
try:
|
||||
threadLock.aquire()
|
||||
with threadLock:
|
||||
state["east-door"] = "opened"
|
||||
persistState()
|
||||
finally:
|
||||
threadLock.release()
|
||||
|
||||
|
||||
def eastDoorClosed():
|
||||
try:
|
||||
threadLock.aquire()
|
||||
with threadLock:
|
||||
state["east-door"] = "closed"
|
||||
persistState()
|
||||
finally:
|
||||
threadLock.release()
|
||||
|
||||
|
||||
def westDoorOpened():
|
||||
try:
|
||||
threadLock.aquire()
|
||||
with threadLock:
|
||||
state["west-door"] = "opened"
|
||||
persistState()
|
||||
finally:
|
||||
threadLock.release()
|
||||
|
||||
|
||||
def westDoorClosed():
|
||||
try:
|
||||
threadLock.aquire()
|
||||
with threadLock:
|
||||
state["west-door"] = "closed"
|
||||
persistState()
|
||||
finally:
|
||||
threadLock.release()
|
||||
|
||||
|
||||
def persistState():
|
||||
|
|
Loading…
Reference in New Issue