mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-23 00:01:16 -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:
@@ -162,7 +162,7 @@ class variable_entry_t {
|
||||
wcstring value; /**< Value of the variable */
|
||||
};
|
||||
|
||||
static std::mutex env_lock;
|
||||
static fish_mutex_t env_lock;
|
||||
|
||||
static bool local_scope_exports(const env_node_t *n);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user