mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-01-25 09:40:21 +01:00
prevent multiple creation of cpu usage thread
This commit is contained in:
parent
90f319ebda
commit
a1cbc45b88
|
|
@ -7,11 +7,13 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
class CpuUsageThread(threading.Thread):
|
||||
sharedInstance = None
|
||||
creationLock = threading.Lock()
|
||||
|
||||
@staticmethod
|
||||
def getSharedInstance():
|
||||
if CpuUsageThread.sharedInstance is None:
|
||||
CpuUsageThread.sharedInstance = CpuUsageThread()
|
||||
with CpuUsageThread.creationLock:
|
||||
if CpuUsageThread.sharedInstance is None:
|
||||
CpuUsageThread.sharedInstance = CpuUsageThread()
|
||||
return CpuUsageThread.sharedInstance
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue