Adopt lambda-style perform_on_main in complete.cpp

Allows eliminating complete_load_no_reload
This commit is contained in:
ridiculousfish 2017-01-23 10:43:34 -08:00
parent 66a0f18410
commit e0abfee370

View file

@ -835,14 +835,6 @@ static void complete_load(const wcstring &name, bool reload) {
completion_autoloader.load(name, reload);
}
/// Performed on main thread, from background thread. Return type is ignored.
static int complete_load_no_reload(wcstring *name) {
assert(name != NULL);
ASSERT_IS_MAIN_THREAD();
complete_load(*name, false);
return 0;
}
/// complete_param: Given a command, find completions for the argument str of command cmd_orig with
/// previous option popt.
///
@ -868,8 +860,10 @@ bool completer_t::complete_param(const wcstring &scmd_orig, const wcstring &spop
complete_load(cmd, true);
} else if (this->type() == COMPLETE_AUTOSUGGEST &&
!completion_autoloader.has_tried_loading(cmd)) {
// Load this command (on the main thread).
iothread_perform_on_main(complete_load_no_reload, &cmd);
// Load this command (on the main thread)
iothread_perform_on_main([&](){
complete_load(cmd, false);
});
}
// Make a list of lists of all options that we care about.