--- deliantra/server/lib/cf.pm 2007/01/05 17:07:17 1.138 +++ deliantra/server/lib/cf.pm 2007/01/05 19:12:03 1.139 @@ -28,7 +28,7 @@ # work around bug in YAML::Syck - bad news for perl6, will it be as broken wrt. unicode? $YAML::Syck::ImplicitUnicode = 1; -$Coro::main->prio (2); # run main coroutine ("the server") with very high priority +$Coro::main->prio (Coro::PRIO_MAX); # run main coroutine ("the server") with very high priority sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload @@ -265,8 +265,10 @@ })->prio (Coro::PRIO_MAX); while ($busy) { - Coro::cede_notself; - Event::one_event unless Coro::nready; + unless (Coro::cede) { + Coro::nready ? Event::one_event 0 : Event::one_event; + Coro::cede_notself unless Coro::cede; + } } wantarray ? @res : $res[0] @@ -1270,7 +1272,10 @@ sub find_sync { my ($path, $origin) = @_; - cf::sync_job { cf::map::find $path, $origin } + cf::sync_job { + my $map = cf::map::find $path, $origin; + $map + } } sub do_load_sync { @@ -1540,13 +1545,14 @@ # try to abort aborted map switching on player login :) # should happen only on crashes if ($pl->ob->{_link_pos}) { + $pl->ob->enter_link; - Coro::async_pool { + (Coro::async_pool { # we need this sleep as the login has a concurrent enter_exit running # and this sleep increases chances of the player not ending up in scorn Coro::Timer::sleep 1; $pl->ob->leave_link; - }; + })->prio (2); } }, ); @@ -1982,6 +1988,9 @@ $EMERGENCY_POSITION = $CFG{emergency_position} || ["/world/world_105_115", 5, 37]; + $cf::map::MAX_RESET = $CFG{map_max_reset} if exists $CFG{map_max_reset}; + $cf::map::DEFAULT_RESET = $CFG{map_default_reset} if exists $CFG{map_default_reset}; + if (exists $CFG{mlockall}) { eval { $CFG{mlockall} ? &mlockall : &munlockall @@ -1995,9 +2004,7 @@ # we must not ever block the main coroutine local $Coro::idle = sub { Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d# - (Coro::unblock_sub { - Event::one_event; - })->(); + Coro::async_pool { Event::one_event }; }; cfg_load;