26 (2020-03-06 01:34:49 отредактировано toxa)

Re: Как сделать выборку по свечам?

toxa пишет:

swerg, и, кстати, раз уж мы говорим про перекореженную lua-машину квика, то можно попробовать такой концепт

я попробовал, и оно вполне себе работает. если интересно, могу выложить на гитхаб.

27 (2020-03-08 00:30:12 отредактировано toxa)

Re: Как сделать выборку по свечам?

вот: [url]https://github.com/untoxa/lua_threads[/url] как proof-of-concept интересно, но пользоваться этим лучше не надо. позволяет делать всякое такое:

tlib = require "lua_threads"
                         
function threadfunc2(astr)
    message(astr, 1);
    while not tlib.IsCurrentThreadTerminated() do
        --
    end
    message('thread2 exit')
end
 
function threadfunc(astr)
    thread2 = tlib.CreateThread(threadfunc2, "hello, world from thread2")
    message(astr, 1);
    while true do
        -- 
    end
end

function main()
    message("hello from main() from thread0", 1)
    thread1 = tlib.CreateThread(threadfunc, "hello, world from thread1")
    local i = 0
    while not GlobalExit() do
        i = i + 1
        if i == 10000000 then
            message("force free thread1", 1)
            thread1 = nil
            collectgarbage()           
            message("free thread1 done", 1)
        end 
    end
    thread1 = nil
    thread2 = nil
    collectgarbage()
    message('main() exit', 1)
end