in reply to Responsive GUI without threads

Most event loops have some form of do_one_event call that makes them tick through the next pending event then return. Find this routine for your particular GUI toolkit and intersperse calls to it throughout your long task.

Replies are listed 'Best First'.
Re^2: Responsive GUI without threads
by BrowserUk (Patriarch) on Oct 25, 2006 at 11:56 UTC

    But what if the long task involves a single op code, like a sort, or a regex search with complex requirements on a large volume of data.

    Or if it involves a blocking call to an external source of data, like the filesystem, network, or a DB?

    Or a call to a cpan module that doesn't have any convenient callback mechanism--like any of the graphics processors, or many of the XML processors, or maths or statistics routines that need to process your large lump of data in one go?

    Or a call to the OS that takes as long as it takes and provides no mechanism for smaller granularity?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.