mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
Changes to block signals for a smaller time interval during saving
This commit is contained in:
parent
f24a0170be
commit
2ae56564ef
1 changed files with 26 additions and 26 deletions
20
history.cpp
20
history.cpp
|
@ -593,14 +593,9 @@ void history_t::save_internal()
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
signal_block();
|
|
||||||
|
|
||||||
wcstring tmp_name = history_filename(name, L".tmp");
|
wcstring tmp_name = history_filename(name, L".tmp");
|
||||||
if( ! tmp_name.empty() )
|
if( ! tmp_name.empty() )
|
||||||
{
|
{
|
||||||
FILE *out;
|
|
||||||
if( (out=wfopen( tmp_name, "w" ) ) )
|
|
||||||
{
|
|
||||||
|
|
||||||
/* Load old */
|
/* Load old */
|
||||||
load_old_if_needed();
|
load_old_if_needed();
|
||||||
|
@ -620,6 +615,11 @@ void history_t::save_internal()
|
||||||
lru.add_item(*iter);
|
lru.add_item(*iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal_block();
|
||||||
|
|
||||||
|
FILE *out;
|
||||||
|
if( (out=wfopen( tmp_name, "w" ) ) )
|
||||||
|
{
|
||||||
/* Write them out */
|
/* Write them out */
|
||||||
for (history_lru_cache_t::iterator iter = lru.begin(); iter != lru.end(); iter++) {
|
for (history_lru_cache_t::iterator iter = lru.begin(); iter != lru.end(); iter++) {
|
||||||
const history_lru_node_t *node = *iter;
|
const history_lru_node_t *node = *iter;
|
||||||
|
@ -629,9 +629,6 @@ void history_t::save_internal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we clear all nodes, since this doesn't happen automatically */
|
|
||||||
lru.evict_all_nodes();
|
|
||||||
|
|
||||||
if( fclose( out ) || !ok )
|
if( fclose( out ) || !ok )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -646,6 +643,11 @@ void history_t::save_internal()
|
||||||
wrename(tmp_name, new_name);
|
wrename(tmp_name, new_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal_unblock();
|
||||||
|
|
||||||
|
/* Make sure we clear all nodes, since this doesn't happen automatically */
|
||||||
|
lru.evict_all_nodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ok )
|
if( ok )
|
||||||
|
@ -653,8 +655,6 @@ void history_t::save_internal()
|
||||||
/* Our history has been written to the file, so clear our state so we can re-reference the file. */
|
/* Our history has been written to the file, so clear our state so we can re-reference the file. */
|
||||||
this->clear_file_state();
|
this->clear_file_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
signal_unblock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void history_t::save(void) {
|
void history_t::save(void) {
|
||||||
|
|
Loading…
Reference in a new issue