Yeah, that's exactly what I'm trying to do. I was going based on the thread in perl-win32-porters (I've since manually cross-posted this message there..)
"Perl_get_context returns 0 (resulting in abort)" which starts here, but doesn't thread properly (oh, the irony): http://aspn.activestate.com/ASPN/Mail/Message/perl-win32-porters/1136526 This thread seems to imply that it's possible, but that might be wishful thinking. Anyway, thanks. It seems quite reasonable that it would be illegal too. I'll let you know if I sort it out/workaround it. scott -----Original Message----- From: Tikka, Sami [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 2:30 AM To: Graham, Scott; [EMAIL PROTECTED] Subject: RE: call_pv from different thread I'm puzzled at what you are trying to do. Are you trying to run 2 threads in the same Perl interpreter? Is that even possible? You have the primary thread running in Perl, it calls an XS, which spawns a secondary thread which waits for something to happen while the primary thread continues and then later the secondary thread calls into the same Perl interpreter where the primary thread is already running? I thought that was illegal. I'd like to be proven wrong... -- Sami Tikka, senior software engineer, F-Secure Corporation tel: +358 9 2520 5115, fax: +358 9 2520 5015 http://www.F-Secure.com F-Secure: Securing the Mobile Enterprise >-----Original Message----- >From: Graham, Scott [mailto:[EMAIL PROTECTED]] >Sent: Sunday, June 16, 2002 4:29 AM >To: '[EMAIL PROTECTED]' >Subject: call_pv from different thread > > >Hello all.. > >I'm trying to write a simple (?) XS that watches some stuff on >a secondary >thread, and when a WaitForSingleObject is signalled does a >call_pv back into >Perl to tell my Perl part that something's happened. > >I'm using ActiveState's binaries: "This is perl, v5.6.1 built for >MSWin32-x86-multi-thread". > >The relevant textbook bit of code is: > > dSP; > ENTER ; > SAVETMPS ; > > PUSHMARK(SP) ; > XPUSHs(sv_2mortal(newSVpv(pszFilePath, strlen(pszFilePath)))) ; > PUTBACK ; > > call_pv("MyCallback", G_DISCARD); > > FREETMPS ; > LEAVE ; > > >When I first started, I wasn't doing PERL_GET_CONTEXT and >PERL_SET_CONTEXT >to keep me in the correct context and was getting a GPF on the >first line: >"dSP;". > >When I do GET_TLS_CONTEXT in the first thread, and then >ENTER_TLS_CONTEXT >and LEAVE_TLS_CONTEXT around the above code (which is in the >second thread), >I get farther: it's the call_pv that GPFs. I'm stumped as to why that's >crashing. Any suggestions? > >The GET_TLS_CONTEXT et al. are taken from SDLperl and look like: > >#define GET_TLS_CONTEXT parent_perl = (PerlInterpreter >*)PERL_GET_CONTEXT; >#define ENTER_TLS_CONTEXT \ > PerlInterpreter *current_perl = (PerlInterpreter >*)PERL_GET_CONTEXT; >\ > PERL_SET_CONTEXT(parent_perl); { \ > PerlInterpreter *my_perl = >parent_perl; >#define LEAVE_TLS_CONTEXT \ > } >PERL_SET_CONTEXT(current_perl); > > >Any help will be greatly appreciated. > >thanks, >scott >_______________________________________________ >Perl-Win32-Users mailing list >[EMAIL PROTECTED] >To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs