… | |
… | |
2031 | |
2031 | |
2032 | cf::lock_wait "map_data:$path";#d#remove |
2032 | cf::lock_wait "map_data:$path";#d#remove |
2033 | cf::lock_wait "map_find:$path"; |
2033 | cf::lock_wait "map_find:$path"; |
2034 | |
2034 | |
2035 | $cf::MAP{$path} || do { |
2035 | $cf::MAP{$path} || do { |
2036 | my $guard1 = cf::lock_acquire "map_find:$path"; |
|
|
2037 | my $guard2 = cf::lock_acquire "map_data:$path"; # just for the fun of it |
2036 | my $guard1 = cf::lock_acquire "map_data:$path"; # just for the fun of it |
|
|
2037 | my $guard2 = cf::lock_acquire "map_find:$path"; |
2038 | |
2038 | |
2039 | my $map = new_from_path cf::map $path |
2039 | my $map = new_from_path cf::map $path |
2040 | or return; |
2040 | or return; |
2041 | |
2041 | |
2042 | $map->{last_save} = $cf::RUNTIME; |
2042 | $map->{last_save} = $cf::RUNTIME; |
… | |
… | |
2045 | or return; |
2045 | or return; |
2046 | |
2046 | |
2047 | if ($map->should_reset) {#d#TODO# disabled, crashy (locking issue?) |
2047 | if ($map->should_reset) {#d#TODO# disabled, crashy (locking issue?) |
2048 | # doing this can freeze the server in a sync job, obviously |
2048 | # doing this can freeze the server in a sync job, obviously |
2049 | #$cf::WAIT_FOR_TICK->wait; |
2049 | #$cf::WAIT_FOR_TICK->wait; |
|
|
2050 | undef $guard2; |
2050 | undef $guard1; |
2051 | undef $guard1; |
2051 | undef $guard2; |
|
|
2052 | $map->reset; |
2052 | $map->reset; |
2053 | return find $path; |
2053 | return find $path; |
2054 | } |
2054 | } |
2055 | |
2055 | |
2056 | $cf::MAP{$path} = $map |
2056 | $cf::MAP{$path} = $map |