mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-15 15:00:46 +00:00
remove thread local var
This commit is contained in:
parent
c4fb560e8c
commit
100297d49a
@ -7,8 +7,7 @@ module Voicemeeter
|
|||||||
def init_producer(que)
|
def init_producer(que)
|
||||||
@producer = Thread.new do
|
@producer = Thread.new do
|
||||||
Thread.current.name = "producer"
|
Thread.current.name = "producer"
|
||||||
Thread.current[:running] = true
|
while @running
|
||||||
while Thread.current[:running]
|
|
||||||
que << :pdirty if event.pdirty
|
que << :pdirty if event.pdirty
|
||||||
que << :mdirty if event.mdirty
|
que << :mdirty if event.mdirty
|
||||||
que << :midi if event.midi
|
que << :midi if event.midi
|
||||||
@ -16,7 +15,7 @@ module Voicemeeter
|
|||||||
sleep(@ratelimit)
|
sleep(@ratelimit)
|
||||||
end
|
end
|
||||||
logger.debug "closing #{Thread.current.name} thread"
|
logger.debug "closing #{Thread.current.name} thread"
|
||||||
que << Thread.current[:running]
|
que << @running
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,12 +50,13 @@ module Voicemeeter
|
|||||||
|
|
||||||
def init_event_threads
|
def init_event_threads
|
||||||
que = Queue.new
|
que = Queue.new
|
||||||
|
@running = true
|
||||||
init_worker(que) and init_producer(que)
|
init_worker(que) and init_producer(que)
|
||||||
end
|
end
|
||||||
|
|
||||||
def end_event_threads
|
def end_event_threads
|
||||||
if running?
|
if running?
|
||||||
@producer[:running] = false
|
@running = false
|
||||||
@producer.join
|
@producer.join
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user