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.216 by root, Thu Feb 15 14:30:21 2007 UTC vs.
Revision 1.219 by root, Sat Feb 17 03:19:44 2007 UTC

354 354
355 $coro 355 $coro
356} 356}
357 357
358sub write_runtime { 358sub write_runtime {
359 my $guard = cf::lock_acquire "write_runtime";
360
359 my $runtime = cf::localdir . "/runtime"; 361 my $runtime = cf::localdir . "/runtime";
360 362
361 my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644 363 my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644
362 or return; 364 or return;
363 365
2242} 2244}
2243 2245
2244############################################################################# 2246#############################################################################
2245# the server's init and main functions 2247# the server's init and main functions
2246 2248
2247sub load_resources { 2249sub init_resources {
2248 load_regions sprintf "%s/%s/regions", cf::datadir, cf::mapdir 2250 load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir
2249 or die "unable to load regions file\n";#d# 2251 or die "unable to load regions file\n";#d#
2250} 2252}
2251 2253
2252sub cfg_load { 2254sub cfg_load {
2253 open my $fh, "<:utf8", cf::confdir . "/config" 2255 open my $fh, "<:utf8", cf::confdir . "/config"
2269 warn $@ if $@; 2271 warn $@ if $@;
2270 } 2272 }
2271} 2273}
2272 2274
2273sub init { 2275sub init {
2274 load_resources; 2276 init_resources;
2275} 2277}
2276 2278
2277sub main { 2279sub main {
2278 # we must not ever block the main coroutine 2280 # we must not ever block the main coroutine
2279 local $Coro::idle = sub { 2281 local $Coro::idle = sub {
2453 _global_reattach; 2455 _global_reattach;
2454 warn "reattaching attachments to maps"; 2456 warn "reattaching attachments to maps";
2455 reattach $_ for values %MAP; 2457 reattach $_ for values %MAP;
2456 2458
2457 warn "loading reloadable resources"; 2459 warn "loading reloadable resources";
2458 load_resources; 2460 init_resources;
2459 2461
2460 warn "leaving sync_job"; 2462 warn "leaving sync_job";
2461 2463
2462 1 2464 1
2463 } or do { 2465 } or do {
2520 Coro::async_pool { 2522 Coro::async_pool {
2521 write_runtime 2523 write_runtime
2522 or warn "ERROR: unable to write runtime file: $!"; 2524 or warn "ERROR: unable to write runtime file: $!";
2523 }; 2525 };
2524 } 2526 }
2525
2526 2527
2527 $WAIT_FOR_TICK->broadcast; 2528 $WAIT_FOR_TICK->broadcast;
2528 $WAIT_FOR_TICK_ONE->send if $WAIT_FOR_TICK_ONE->awaited; 2529 $WAIT_FOR_TICK_ONE->send if $WAIT_FOR_TICK_ONE->awaited;
2529 2530
2530# my $AFTER = Event::time; 2531# my $AFTER = Event::time;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines