Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/oven.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import threading
import time
import random
import os
import fcntl
import datetime
import logging
import json
Expand Down Expand Up @@ -378,6 +380,13 @@ def heat_then_cool(self):
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()
Expand Down