some threading bugfixes, working on sniping mode

This commit is contained in:
Manuel Simon Hirsig
2016-02-27 15:07:31 +01:00
parent 6b8846b70d
commit 3c87544061
4 changed files with 35 additions and 9 deletions
Binary file not shown.
+21 -8
View File
@@ -14,12 +14,25 @@ end
function public.on_update()
private.event_listeners = Aux.util.set_filter(private.event_listeners, function(l) return not l.deleted end)
local threads = {}
for thread_id, thread in pairs(private.threads) do
if not thread.killed then
threads[thread_id] = thread
end
end
private.threads = threads
for thread_id, k in pairs(private.threads) do
private.threads[thread_id] = nil
public.thread_id = thread_id
k()
public.thread_id = nil
for thread_id, thread in pairs(private.threads) do
if not thread.killed then
local k = thread.k
thread.k = nil
public.thread_id = thread_id
k()
public.thread_id = nil
if not thread.k then
thread.killed = true
end
end
end
end
@@ -75,18 +88,18 @@ do
function public.new_thread(k)
local thread_id = next_thread_id
next_thread_id = next_thread_id + 1
private.threads[thread_id] = k
private.threads[thread_id] = { k = k }
return thread_id
end
end
function public.kill_thread(thread_id)
private.threads[thread_id] = nil
private.threads[thread_id].killed = true
end
function public.wait(...)
local k = tremove(arg, 1)
private.threads[public.thread_id] = function() return k(unpack(arg)) end
private.threads[public.thread_id].k = function() return k(unpack(arg)) end
end
function public.wait_until(p, ...)
BIN
View File
Binary file not shown.
+14 -1
View File
@@ -839,9 +839,20 @@ function public.start_search(filter_string)
end
end,
on_read_auction = function(auction_info)
if getn(scanned_records) < 1000 then -- TODO static popup, remove discard
if getn(scanned_records) == 0 then
SetCVar('MasterSoundEffects', 0)
SetCVar('MasterSoundEffects', 1)
PlaySoundFile([[Interface\AddOns\Aux-AddOn\Event_wardrum_ogre.ogg]], 'Master')
PlaySoundFile([[Interface\AddOns\Aux-AddOn\scourge_horn.ogg]], 'Master')
tinsert(scanned_records, auction_info)
private.results_listing:SetDatabase()
Aux.control.on_next_update(function()
Aux.scan.abort('list')
end)
end
-- if getn(scanned_records) < 1000 then -- TODO static popup, remove discard
-- tinsert(scanned_records, auction_info)
-- end
end,
on_complete = function()
private.results_listing:SetDatabase()
@@ -850,6 +861,8 @@ function public.start_search(filter_string)
private.stop_button:Hide()
private.search_button:Show()
public.start_search(filter_string)
end,
on_abort = function()
private.results_listing:SetDatabase()