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.263 by root, Sat May 5 05:40:27 2007 UTC vs.
Revision 1.264 by root, Sun May 6 05:44:48 2007 UTC

367 367
368 $coro 368 $coro
369} 369}
370 370
371sub write_runtime { 371sub write_runtime {
372 my $runtime = "$LOCALDIR/runtime";
373
374 # first touch the runtime file to show we are still running:
375 # the fsync below can take a very very long time.
376
377 warn "touching runtime...\n";#d#
378 if (my $fh = aio_open $runtime, O_WRONLY, 0) {
379 utime undef, undef, $fh;
380 }
381
372 my $guard = cf::lock_acquire "write_runtime"; 382 my $guard = cf::lock_acquire "write_runtime";
373
374 my $runtime = "$LOCALDIR/runtime";
375 383
376 warn "starting to write runtime...\n";#d# 384 warn "starting to write runtime...\n";#d#
377 my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644 385 my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644
378 or return; 386 or return;
379 387
385 and return; 393 and return;
386 394
387 # always fsync - this file is important 395 # always fsync - this file is important
388 aio_fsync $fh 396 aio_fsync $fh
389 and return; 397 and return;
398
399 # touch it again to show we are up-to-date
400 utime undef, undef, $fh;
390 401
391 close $fh 402 close $fh
392 or return; 403 or return;
393 404
394 aio_rename "$runtime~", $runtime 405 aio_rename "$runtime~", $runtime

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines