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.174 by root, Sun Jan 14 19:55:37 2007 UTC vs.
Revision 1.175 by root, Sun Jan 14 21:20:51 2007 UTC

8use Storable; 8use Storable;
9use Opcode; 9use Opcode;
10use Safe; 10use Safe;
11use Safe::Hole; 11use Safe::Hole;
12 12
13use Coro 3.3 (); 13use Coro 3.4 ();
14use Coro::Event; 14use Coro::Event;
15use Coro::Timer; 15use Coro::Timer;
16use Coro::Signal; 16use Coro::Signal;
17use Coro::Semaphore; 17use Coro::Semaphore;
18use Coro::AIO; 18use Coro::AIO;
2228 2228
2229sub main { 2229sub main {
2230 # we must not ever block the main coroutine 2230 # we must not ever block the main coroutine
2231 local $Coro::idle = sub { 2231 local $Coro::idle = sub {
2232 Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d# 2232 Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d#
2233 (async {
2234 warn "BP1\n";#d#
2233 async { Event::one_event }; 2235 Event::one_event;
2236 warn "BP2\n";#d#
2237 })->prio (Coro::PRIO_MAX);
2234 }; 2238 };
2235 2239
2236 cfg_load; 2240 cfg_load;
2237 db_load; 2241 db_load;
2238 load_extensions; 2242 load_extensions;
2386 } 2390 }
2387 2391
2388 warn "reloaded"; 2392 warn "reloaded";
2389}; 2393};
2390 2394
2395our $RELOAD_WATCHER; # used only during reload
2396
2391register_command "reload" => sub { 2397register_command "reload" => sub {
2392 my ($who, $arg) = @_; 2398 my ($who, $arg) = @_;
2393 2399
2394 if ($who->flag (FLAG_WIZ)) { 2400 if ($who->flag (FLAG_WIZ)) {
2395 $who->message ("start of reload."); 2401 $who->message ("reloading server.");
2402
2403 # doing reload synchronously and two reloads happen back-to-back,
2404 # coro crashes during coro_state_free->destroy here.
2405
2406 $RELOAD_WATCHER ||= Event->timer (after => 0, data => WF_AUTOCANCEL, cb => sub {
2396 reload; 2407 reload;
2397 $who->message ("end of reload."); 2408 undef $RELOAD_WATCHER;
2409 });
2398 } 2410 }
2399}; 2411};
2400 2412
2401unshift @INC, $LIBDIR; 2413unshift @INC, $LIBDIR;
2402 2414

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines