develooper Front page | perl.perl5.porters | Postings from November 2003

Re: need your help to do some (simple?) patching

Thread Previous | Thread Next
Nick Ing-Simmons
November 17, 2003 03:08
Re: need your help to do some (simple?) patching
Message ID:
Jan Dubois <> writes:
>On Mon, 17 Nov 2003 09:09:32 +0000, Nick Ing-Simmons
><> wrote:
>>>XS modules already don't have to call PERL_SET_CONTEXT at all if you write
>>>them correctly (using PERL_NO_GET_CONTEXT, passing the context explicitly
>>>to pure C functions).  Maybe this information should be published more
>>>prominently so that new modules take advantage of that.
>>It is a pain to upgrade a complex XS to PERL_NO_GET_CONTEXT style,
>>but it should be encouraged.
>>Tk has problems in that callbacks need to get an aTHX from somewhere.
>Can't you allocate additional per-window memory with cbWndExtra in your
>RegisterClass call, and then store the context in there using

Not on X11.

So I have to have some other Tk level (rather than native level)
place to put this. There is still the snag that folk want to 
be able to use widgets from multiple threads (the obvious one being 
to have one thread doing event loop and another filling in widget

>I recognize that this is Windows specific, but at least on Windows it is
>not safe to call PERL_GET_CONTEXT from a Window callback.  

Which is why I don't claim even Tk804 to be thread ready yet.

>It is possible
>that an embedding application has switched to a different Perl interpreter
>and is executing some code that spins the messageloop.  Any message
>callbacks will now execute in the wrong interpreter unless the callback
>sets/restores the context.
>It is probably an uncommon scenario, but I've seen it happen in the past
>(not with Tk though).

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About