Delete watcher.py
This commit is contained in:
parent
eab2474101
commit
bd5d0f26e9
1 changed files with 0 additions and 32 deletions
|
@ -1,32 +0,0 @@
|
|||
from dataclasses import dataclass
|
||||
import multiprocessing
|
||||
import time
|
||||
from typing import *
|
||||
|
||||
|
||||
class Watcher:
|
||||
_queue: multiprocessing.Array
|
||||
_lock: multiprocessing.Lock
|
||||
|
||||
def __init__(self):
|
||||
self._lock = multiprocessing.Lock()
|
||||
self._queue = multiprocessing.Array(lock=False)
|
||||
|
||||
def start(self):
|
||||
multiprocessing.Process(
|
||||
target=self._worker, args=(self._queue, self._lock)
|
||||
).start()
|
||||
|
||||
@staticmethod
|
||||
def _worker(jobs: multiprocessing.Array, lock: multiprocessing.Lock):
|
||||
while True:
|
||||
time.sleep(60)
|
||||
|
||||
lock.acquire()
|
||||
|
||||
jobs.pop()
|
||||
|
||||
lock.release()
|
||||
|
||||
def register(self, ws: WatchState):
|
||||
self._queue.append(ws)
|
Reference in a new issue