in reply to Tk and Threads (again)
Just as a follow-on to zentara's excellent suggestion, I would mention that $mw->repeat(10, ...) shouldn't, I feel, be considered a bad idea. I mean, yes it's "wasteful" in the sense that there is an overhead imposed for the large majority of the time when it doesn't find anything in the queue, but at the same time, threads impose a rather substantial overhead penalty as well because they force Perl to implement preemptive multitasking within a single process, which is no mean feat.
I don't have hard numbers, but I can support this anecdotally by observing that I tried implementing something sort of like this where I needed an LWP GET request to update a Tk progress bar. I got a much smoother result by having the :content_cb subroutine from my LWP::UserAgent call $mw->update directly than by having LWP and the Tk MainLoop running in separate threads.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tk and Threads (again)
by BrowserUk (Patriarch) on Jan 22, 2006 at 22:45 UTC | |
by Errto (Vicar) on Jan 23, 2006 at 03:28 UTC | |
by BrowserUk (Patriarch) on Jan 23, 2006 at 08:01 UTC | |
by Courage (Parson) on Jan 23, 2006 at 16:50 UTC | |
by BrowserUk (Patriarch) on Jan 23, 2006 at 17:10 UTC | |
|