On Mon, Feb 06, 2006 at 05:53:18AM -0800, Gisle Aas wrote:
> Tim Bunce <[EMAIL PROTECTED]> writes:
> 
> > I agree. Any chance yould you patch lib/DBI/DBD.pm to add in a section
> > describing what driver authors need to do?
> 
> Is this enough?

That's great. I tweaked it a bit and appended the body of it below. Let
me know if I've said anything wrong.

Driver authors please take note!

Tim.


+With DBI v1.51 or better I recommend that the driver defines
+PERL_NO_GET_CONTEXT before F<DBIXS.h> is included. This can significantly
+improve efficiency when running under a thread enabled perl. (Remember that
+the standard perl in most Linux distributions is built with threads enabled.
+So is ActiveState perl for Windows, and perl built for Apache mod_perl2.)
+If you do this there are some things to keep in mind:
 
+B<*> If PERL_NO_GET_CONTEXT is defined, then every function that calls the Perl
+API will need to start out with a C<dTHX;> declaration.
+
+B<*> You'll know which functions need this, because the C compiler will
+complain that the undeclared identifier C<myperl> is used if I<and only if>
+the perl you are using to develop and test your driver has threads enabled.
+
+B<*> So if you don't remember to test with a thread-enabled perl before making
+a release it's likely that you'll get failure reports from users who are.
+
+B<*> For driver private functions it is possible to gain even more
+efficiency by replacing C<dTHX;> with C<pTHX_> prepended to the
+parameter list and then C<aTHX_> prepended to the argument list where
+the function is called.
+
+See L<perlguts/How multiple interpreters and concurrency are supported> for
+additional information about PERL_NO_GET_CONTEXT.

Reply via email to