multithreading - Which is the correct way to wait for a Thread.finalization and keep my application responsive -
actually using code , works ok, 'am wondering if correct way.
while waitforsingleobject(mythread.handle, 0) = wait_timeout application.processmessages; showmessage('i done');
calling application.processmessages
considered code smell. let main thread idle if it's got nothing do.
if ran company , needed 1 of workers run store , grab much-needed supplies, pace door until got back, or prefer sit in office , rest , wait him, , find out supplies here because hear him walk through door? either way, he'll take same amount of time, first way's gonna wear legs out.
similarly, instead of having ui watch thread, have thread report ui. 1 way have thread use postmessage
send custom message form launched once it's finished, , put message handler on form respond it.
Comments
Post a Comment