Jan Dubois wrote:
On Tue, 30 Nov 2004, Stas Bekman wrote:

What about the solution of ithreads? Originally ithreads were storing
their context in ThreadLocalStorage, and this didn't work under mp2,
so it was rewritten to store the context in a perl PL_ interpreter
global, now ithreads can be run inside the same thread.


I'm not sure what you are referring to.  As far as I know the Perl context
for a thread is still stored in TLS.  Can you point me to the relevant
changes and/or the PL_ name you are talking about?

The main self context is not stored in TLS since 5.8.1. If it was it would be impossible to load and run ithreads::shared under mp2.


ext/threads/threads.xs:

void Perl_ithread_set (pTHX_ ithread* thread)
{
  SV* thread_sv = newSViv(PTR2IV(thread));
  if(!hv_store(PL_modglobal, "threads::self", 12, thread_sv,0)) {
    croak("%s\n","Internal error, couldn't set TLS");
  }
}

Could the same solution be applied for COM context? Make it
independent from threads?


You will have to ask Microsoft about this. Something tells me their
answer will be: "Don't use COM, use .NET".

For Win32::OLE this could be solved by only using the free-threaded
apartment model, which is already done by default. But you will still
need to initialize each new thread to join that apartment.  I guess each
Perl interpreter could keep a global cache of thread ids and just try
to call CoInitialize() when it hasn't been run in this thread before.
Of course this will require all Perl interpreters to use the same
COM threading model, but that is not really a big restriction.

Sounds like database connection pooling :)


-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to