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():
|
def eastDoorOpened():
|
||||||
try:
|
with threadLock:
|
||||||
threadLock.aquire()
|
|
||||||
state["east-door"] = "opened"
|
state["east-door"] = "opened"
|
||||||
persistState()
|
persistState()
|
||||||
finally:
|
|
||||||
threadLock.release()
|
|
||||||
|
|
||||||
|
|
||||||
def eastDoorClosed():
|
def eastDoorClosed():
|
||||||
try:
|
with threadLock:
|
||||||
threadLock.aquire()
|
|
||||||
state["east-door"] = "closed"
|
state["east-door"] = "closed"
|
||||||
persistState()
|
persistState()
|
||||||
finally:
|
|
||||||
threadLock.release()
|
|
||||||
|
|
||||||
|
|
||||||
def westDoorOpened():
|
def westDoorOpened():
|
||||||
try:
|
with threadLock:
|
||||||
threadLock.aquire()
|
|
||||||
state["west-door"] = "opened"
|
state["west-door"] = "opened"
|
||||||
persistState()
|
persistState()
|
||||||
finally:
|
|
||||||
threadLock.release()
|
|
||||||
|
|
||||||
|
|
||||||
def westDoorClosed():
|
def westDoorClosed():
|
||||||
try:
|
with threadLock:
|
||||||
threadLock.aquire()
|
|
||||||
state["west-door"] = "closed"
|
state["west-door"] = "closed"
|
||||||
persistState()
|
persistState()
|
||||||
finally:
|
|
||||||
threadLock.release()
|
|
||||||
|
|
||||||
|
|
||||||
def persistState():
|
def persistState():
|
||||||
|
|
Loading…
Reference in New Issue