… | |
… | |
10 | use Opcode; |
10 | use Opcode; |
11 | use Safe; |
11 | use Safe; |
12 | use Safe::Hole; |
12 | use Safe::Hole; |
13 | use Storable (); |
13 | use Storable (); |
14 | |
14 | |
15 | use Coro 4.1 (); |
15 | use Coro 4.32 (); |
16 | use Coro::State; |
16 | use Coro::State; |
17 | use Coro::Handle; |
17 | use Coro::Handle; |
18 | use Coro::EV; |
18 | use Coro::EV; |
19 | use Coro::Timer; |
19 | use Coro::Timer; |
20 | use Coro::Signal; |
20 | use Coro::Signal; |
21 | use Coro::Semaphore; |
21 | use Coro::Semaphore; |
22 | use Coro::AIO; |
22 | use Coro::AIO; |
|
|
23 | use Coro::BDB; |
23 | use Coro::Storable; |
24 | use Coro::Storable; |
24 | use Coro::Util (); |
25 | use Coro::Util (); |
25 | |
26 | |
26 | use JSON::XS 2.01 (); |
27 | use JSON::XS 2.01 (); |
27 | use BDB (); |
28 | use BDB (); |
… | |
… | |
3630 | }; |
3631 | }; |
3631 | $TICK_WATCHER->priority (EV::MAXPRI); |
3632 | $TICK_WATCHER->priority (EV::MAXPRI); |
3632 | |
3633 | |
3633 | { |
3634 | { |
3634 | BDB::min_parallel 8; |
3635 | BDB::min_parallel 8; |
3635 | BDB::max_poll_time $TICK * 0.1; |
3636 | BDB::max_poll_reqs $TICK * 0.1; |
3636 | $BDB_POLL_WATCHER = EV::io BDB::poll_fileno, EV::READ, \&BDB::poll_cb; |
|
|
3637 | |
|
|
3638 | BDB::set_sync_prepare { |
|
|
3639 | my $status; |
|
|
3640 | my $current = $Coro::current; |
|
|
3641 | ( |
|
|
3642 | sub { |
|
|
3643 | $status = $!; |
|
|
3644 | $current->ready; undef $current; |
|
|
3645 | }, |
|
|
3646 | sub { |
|
|
3647 | Coro::schedule while defined $current; |
|
|
3648 | $! = $status; |
|
|
3649 | }, |
|
|
3650 | ) |
|
|
3651 | }; |
|
|
3652 | |
3637 | |
3653 | unless ($DB_ENV) { |
3638 | unless ($DB_ENV) { |
3654 | $DB_ENV = BDB::db_env_create; |
3639 | $DB_ENV = BDB::db_env_create; |
3655 | $DB_ENV->set_flags (BDB::AUTO_COMMIT | BDB::REGION_INIT | BDB::TXN_NOSYNC |
3640 | $DB_ENV->set_flags (BDB::AUTO_COMMIT | BDB::REGION_INIT | BDB::TXN_NOSYNC |
3656 | | BDB::LOG_AUTOREMOVE, 1); |
3641 | | BDB::LOG_AUTOREMOVE, 1); |