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.66 by root, Tue Sep 12 22:43:31 2006 UTC vs.
Revision 1.67 by root, Tue Sep 12 23:22:32 2006 UTC

872 my $pid; 872 my $pid;
873 873
874 sub db_save() { 874 sub db_save() {
875 warn "saving database $path\n";#d# remove later 875 warn "saving database $path\n";#d# remove later
876 waitpid $pid, 0 if $pid; 876 waitpid $pid, 0 if $pid;
877 unless ($pid = fork) { 877 if (0 == ($pid = fork)) {
878 $db->{_meta}{version} = 1; 878 $db->{_meta}{version} = 1;
879 Storable::nstore $db, "$path~"; 879 Storable::nstore $db, "$path~";
880 rename "$path~", $path; 880 rename "$path~", $path;
881 kill 9, $$ if defined $pid; #d# remove when binary updated
881 cf::_exit 0 if defined $pid; 882 cf::_exit 0 if defined $pid;
882 } 883 }
883 } 884 }
884 885
885 my $dirty; 886 my $dirty;
910 } else { 911 } else {
911 $db->{$_[0]} = $_[1]; 912 $db->{$_[0]} = $_[1];
912 } 913 }
913 db_dirty; 914 db_dirty;
914 } 915 }
916
917 attach_global
918 prio => 10000,
919 on_cleanup => sub {
920 db_sync;
921 },
922 ;
915} 923}
916 924
917############################################################################# 925#############################################################################
918# the server's main() 926# the server's main()
919 927

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines