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

Comparing BDB/BDB.pm (file contents):
Revision 1.2 by root, Mon Feb 5 20:21:38 2007 UTC vs.
Revision 1.3 by root, Mon Feb 5 22:19:07 2007 UTC

65use base 'Exporter'; 65use base 'Exporter';
66 66
67BEGIN { 67BEGIN {
68 our $VERSION = '0.1'; 68 our $VERSION = '0.1';
69 69
70 our @BDB_REQ = qw(); 70 our @BDB_REQ = qw(
71 db_env_create db_env_open db_env_close
72 db_create db_open db_close db_compact db_sync db_put
73 );
74 our @EXPORT = (@BDB_REQ, qw(dbreq_pri dbreq_nice));
71 our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush 75 our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush
72 min_parallel max_parallel max_idle 76 min_parallel max_parallel max_idle
73 nreqs nready npending nthreads 77 nreqs nready npending nthreads
74 max_poll_time max_poll_reqs); 78 max_poll_time max_poll_reqs);
75 79
236 240
237You can still queue as many requests as you want. Therefore, 241You can still queue as many requests as you want. Therefore,
238C<max_oustsanding> is mainly useful in simple scripts (with low values) or 242C<max_oustsanding> is mainly useful in simple scripts (with low values) or
239as a stop gap to shield against fatal memory overflow (with large values). 243as a stop gap to shield against fatal memory overflow (with large values).
240 244
245=item BDB::set_sync_prepare $cb
246
247Sets a callback that is called whenever a request is created without an
248explicit callback. It has to return two code references. The first is used
249as the request callback, and the second is called to wait until the first
250callback has been called. The default implementation works like this:
251
252 sub {
253 my $status;
254 (
255 sub { $status = $! },
256 sub { BDB::poll while !defined $status; $! = $status },
257 )
258 }
259
260=back
261
241=head3 STATISTICAL INFORMATION 262=head3 STATISTICAL INFORMATION
263
264=over 4
242 265
243=item BDB::nreqs 266=item BDB::nreqs
244 267
245Returns the number of requests currently in the ready, execute or pending 268Returns the number of requests currently in the ready, execute or pending
246states (i.e. for which their callback has not been invoked yet). 269states (i.e. for which their callback has not been invoked yet).
261but not yet processed by poll_cb). 284but not yet processed by poll_cb).
262 285
263=back 286=back
264 287
265=cut 288=cut
289
290set_sync_prepare {
291 my $status;
292 (
293 sub {
294 $status = $!;
295 },
296 sub {
297 BDB::poll while !defined $status;
298 $! = $status;
299 },
300 )
301};
266 302
267min_parallel 8; 303min_parallel 8;
268 304
269END { flush } 305END { flush }
270 306

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines