multithreading - Lua execute several tasks at once -
i have been looking solution execute several task (atleast 2) simultaneously. found coroutines in lua. can please clarify me in detail how handle 2 or more 1 task? trying run execute event , measure memory consumption process using lua script. quick solution or ideas highly appreciated. thanks
take io.popen(prog [, mode])
.
from the documentation io.popen, "starts prog in other process".
here how implement this:
-- launch prog want measure. assume not quit immediately. -- lua not block here: not wait prog exit. io.popen('script-you-want-to-measure') -- launch second process measure first. local measure = io.popen('measuring-process', 'r') -- read block until measure program exits local measure_output = measure:read('*a') f:close() -- want output
Comments
Post a Comment