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

Comparing BDB/BDB.pm (file contents):
Revision 1.36 by root, Sat May 10 20:23:06 2008 UTC vs.
Revision 1.37 by root, Mon Jul 7 14:28:53 2008 UTC

611 611
612=item BDB::set_sync_prepare $cb 612=item BDB::set_sync_prepare $cb
613 613
614Sets a callback that is called whenever a request is created without an 614Sets a callback that is called whenever a request is created without an
615explicit callback. It has to return two code references. The first is used 615explicit callback. It has to return two code references. The first is used
616as the request callback, and the second is called to wait until the first 616as the request callback (it should save the return status), and the second
617is called to wait until the first callback has been called (it must set
618C<$!> to the return status).
619
620This mechanism can be used to include BDB into other event mechanisms,
621such as L<AnyEvent::BDB> or L<Coro::BDB>.
622
617callback has been called. The default implementation works like this: 623The default implementation works like this:
618 624
619 sub { 625 sub {
620 my $status; 626 my $status;
621 ( 627 (
622 sub { $status = $! }, 628 sub { $status = $! },
623 sub { BDB::poll while !defined $status; $! = $status }, 629 sub { BDB::poll while !defined $status; $! = $status },
624 ) 630 )
625 } 631 }
632
633It simply blocks the process till the request has finished and then sets
634C<$!> to the return value. This means that if you don't use a callback,
635BDB will simply fall back to synchronous operations.
626 636
627=back 637=back
628 638
629=head3 STATISTICAL INFORMATION 639=head3 STATISTICAL INFORMATION
630 640

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines