Jan Dubois <jand@ActiveState.com> writes: >On Mon, 17 Nov 2003 09:09:32 +0000, Nick Ing-Simmons ><nick.ing-simmons@elixent.com> 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 >SetWindowLongPtr()? 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 data). > >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). > >Cheers, >-JanThread Previous | Thread Next