Andrew de Quincey 2024-07-06 05:51:59 +10:00 zatwierdzone przez GitHub
commit f8889920bc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -1,6 +1,8 @@
import threading
import time
import random
import os
import fcntl
import datetime
import logging
import json
@ -495,6 +497,13 @@ class SimulatedOven(Oven):
class RealOven(Oven):
def __init__(self):
self.lockfd = os.open('/tmp/kiln.lock', os.O_TRUNC | os.O_CREAT | os.O_RDWR)
try:
fcntl.flock(self.lockfd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except OSError:
print("Unable to start as another process is using the oven")
exit(1)
self.board = Board()
self.output = Output()
self.reset()