mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-19 18:01:15 -03:00
Introduce fish_mutex_t wrapping std::mutex
Add a fish-specific wrapper around std::mutex that records whether it is locked in a bool. This is to make ASSERT_IS_LOCKED() simpler (it can just check the boolean instead of relying on try_lock) which will make Coverity Scan happier. Some details: Coverity Scan was complaining about an apparent double-unlock because it's unaware of the semantics of try_lock(). Specifically fish asserts that a lock is locked by asserting that try_lock fails; if it succeeds fish prints an error and then unlocks the lock (so as not to leave it locked). This unlock is of course correct, but it confused Coverity Scan.
This commit is contained in:
@@ -48,7 +48,7 @@ file_access_attempt_t access_file(const wcstring &path, int mode) {
|
||||
|
||||
autoload_t::autoload_t(const wcstring &env_var_name_var,
|
||||
command_removed_function_t cmd_removed_callback)
|
||||
: lock(), env_var_name(env_var_name_var), command_removed(cmd_removed_callback) {}
|
||||
: env_var_name(env_var_name_var), command_removed(cmd_removed_callback) {}
|
||||
|
||||
void autoload_t::entry_was_evicted(wcstring key, autoload_function_t node) {
|
||||
// This should only ever happen on the main thread.
|
||||
|
||||
Reference in New Issue
Block a user