mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 06:41:14 -03:00
Some work to allow completions to be evaluated off of the main thread
This commit is contained in:
12
common.cpp
12
common.cpp
@@ -2070,5 +2070,15 @@ void assert_is_background_thread(const char *who)
|
||||
if (is_main_thread()) {
|
||||
fprintf(stderr, "Warning: %s called on the main thread (may block!). Break on debug_thread_error to debug.\n", who);
|
||||
debug_thread_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void assert_is_locked(void *vmutex, const char *who)
|
||||
{
|
||||
pthread_mutex_t *mutex = static_cast<pthread_mutex_t*>(vmutex);
|
||||
if (0 == pthread_mutex_trylock(mutex)) {
|
||||
fprintf(stderr, "Warning: %s is not locked when it should be. Break on debug_thread_error to debug.\n", who);
|
||||
debug_thread_error();
|
||||
pthread_mutex_unlock(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user