Subject: | Signals should wake Tk |
Date: | Tue, 09 Mar 2004 20:14:32 +0000 |
To: | bug-tk [...] rt.cpan.org |
From: | Steve Lidie <sol0 [...] Lehigh.EDU> |
On Mar 6, 2004, at 6:09 PM, Nick Ing-Simmons wrote:
Show quoted text
> Steve Lidie <sol0@lehigh.edu> writes:
If youd he arrange it that would be wonderful, obviating my hack ...
>>
>> I suspect this is part of Perl's safe signal handling - the *operating
>> system* signal isn't being delivered because perl isn't doing
>> anything.
>
> With perl5.8 and Tk we have doubly-safe signal handling ;-)
> I think by default Tk delays signals till its event loop wakes up.
> This was a fix for older perls, it may too safe now.
>
>
>> Once you wave the cursor over a window an *X11 signal* is raised and
>> the Tk event loop restarts.
>> So, one way to have an alien process alert an idle Tk program is to
>> never have it idle - i.e. keep the event loop active.
>>
>> So, alien process does "kill USR2, ptk-process", and ptk-process does:
>>
>> $SIG{USR2} = sub { &synchronize };
>> $mw->repeat( 10_000 => sub { $mw->idletasks } );
>>
>> A poll every 10 seconds works for my tape device code, you'll have to
>> find your tradeoff between responsiveness and efficiency. Now to see
>> if there's a more clever way ...
>
> Now that perl has safe signals, I guess Tk could notice that
> a signal is pending and dispatch it when OS breaks into its
> select() call.
>