ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/perlmulticore/perlmulticore.pod
(Generate patch)

Comparing perlmulticore/perlmulticore.pod (file contents):
Revision 1.12 by root, Mon Mar 4 06:42:05 2019 UTC vs.
Revision 1.13 by root, Mon Mar 4 06:46:10 2019 UTC

599 599
600Last not least, while the abovew case studies show some difficult 600Last not least, while the abovew case studies show some difficult
601examples, let's look at a more typical easy case, L<DBD::SQLite>. 601examples, let's look at a more typical easy case, L<DBD::SQLite>.
602 602
603Practically all work is done by calling C<_sqlite_exec> in F<dbdimp.c>, so 603Practically all work is done by calling C<_sqlite_exec> in F<dbdimp.c>, so
604other than providing the file and adding 604other than copying F<perlmulticore.h> into the source tree and adding
605 605
606 #include "perlmulticore.h" 606 #include "perlmulticore.h"
607 607
608To that file, you only need to change the call to C<sqlite3_exec> in 608to that file, you only need to change the call to C<sqlite3_exec> in
609that function by sandwiching it between C<perlinterp_release> and 609that function by sandwiching it between C<perlinterp_release> and
610C<perlinterp_acquire>: 610C<perlinterp_acquire>:
611 611
612 int
613 _sqlite_exec(pTHX_ SV *h, sqlite3 *db, const char *sql)
614 {
615 int rc;
616 char *errmsg;
617
612 perlinterp_release (); // added 618 + perlinterp_release ();
613 rc = sqlite3_exec(db, sql, NULL, NULL, &errmsg); 619 rc = sqlite3_exec(db, sql, NULL, NULL, &errmsg);
614 perlinterp_acquire (); // added 620 + perlinterp_acquire ();
621 ...
615 622
616To also catch the database opening phase, the same needs to be done for 623To also catch the database opening phase, the same needs to be done for
617C<_sqlite_open>: 624C<_sqlite_open>:
618 625
619 _sqlite_open(pTHX_ SV *dbh, const char *dbname, sqlite3 **db, int flags, int extended) 626 _sqlite_open(pTHX_ SV *dbh, const char *dbname, sqlite3 **db, int flags, int extended)
620 { 627 {
621 int rc; 628 int rc;
622 perlinterp_release (); // added 629 + perlinterp_release ();
623 if (flags) { 630 if (flags) {
624 rc = sqlite3_open_v2(dbname, db, flags, NULL); 631 rc = sqlite3_open_v2(dbname, db, flags, NULL);
625 } else { 632 } else {
626 rc = sqlite3_open(dbname, db); 633 rc = sqlite3_open(dbname, db);
627 } 634 }
628 perlinterp_acquire (); // added 635 + perlinterp_acquire ();
629 if ( rc != SQLITE_OK ) { 636 if ( rc != SQLITE_OK ) {
630 637
631And that is it. 638And that is it.
632 639
633=head1 SEE ALSO 640=head1 SEE ALSO
634 641

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines