ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.398 by root, Wed Dec 5 11:08:34 2007 UTC vs.
Revision 1.400 by root, Mon Dec 17 06:36:34 2007 UTC

10use Opcode; 10use Opcode;
11use Safe; 11use Safe;
12use Safe::Hole; 12use Safe::Hole;
13use Storable (); 13use Storable ();
14 14
15use Coro 4.1 (); 15use Coro 4.32 ();
16use Coro::State; 16use Coro::State;
17use Coro::Handle; 17use Coro::Handle;
18use Coro::EV; 18use Coro::EV;
19use Coro::Timer; 19use Coro::Timer;
20use Coro::Signal; 20use Coro::Signal;
21use Coro::Semaphore; 21use Coro::Semaphore;
22use Coro::AIO; 22use Coro::AIO;
23use Coro::BDB;
23use Coro::Storable; 24use Coro::Storable;
24use Coro::Util (); 25use Coro::Util ();
25 26
26use JSON::XS 2.01 (); 27use JSON::XS 2.01 ();
27use BDB (); 28use BDB ();
74our $TICK = MAX_TIME * 1e-6; # this is a CONSTANT(!) 75our $TICK = MAX_TIME * 1e-6; # this is a CONSTANT(!)
75our $TICK_WATCHER; 76our $TICK_WATCHER;
76our $AIO_POLL_WATCHER; 77our $AIO_POLL_WATCHER;
77our $NEXT_RUNTIME_WRITE; # when should the runtime file be written 78our $NEXT_RUNTIME_WRITE; # when should the runtime file be written
78our $NEXT_TICK; 79our $NEXT_TICK;
79our $NOW;
80our $USE_FSYNC = 1; # use fsync to write maps - default off 80our $USE_FSYNC = 1; # use fsync to write maps - default off
81 81
82our $BDB_POLL_WATCHER; 82our $BDB_POLL_WATCHER;
83our $BDB_DEADLOCK_WATCHER; 83our $BDB_DEADLOCK_WATCHER;
84our $BDB_CHECKPOINT_WATCHER; 84our $BDB_CHECKPOINT_WATCHER;
87 87
88our %CFG; 88our %CFG;
89 89
90our $UPTIME; $UPTIME ||= time; 90our $UPTIME; $UPTIME ||= time;
91our $RUNTIME; 91our $RUNTIME;
92our $NOW;
92 93
93our (%PLAYER, %PLAYER_LOADING); # all users 94our (%PLAYER, %PLAYER_LOADING); # all users
94our (%MAP, %MAP_LOADING ); # all maps 95our (%MAP, %MAP_LOADING ); # all maps
95our $LINK_MAP; # the special {link} map, which is always available 96our $LINK_MAP; # the special {link} map, which is always available
96 97
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines