mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 14:01:20 -03:00
Some initial work towards cutting down the number of fork calls we do
This commit is contained in:
@@ -199,8 +199,14 @@ void iothread_service_completion(void) {
|
||||
|
||||
void iothread_drain_all(void) {
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
ASSERT_IS_NOT_FORKED_CHILD();
|
||||
ASSERT_IS_NOT_FORKED_CHILD();
|
||||
if (s_active_thread_count == 0)
|
||||
return;
|
||||
int thread_count = s_active_thread_count;
|
||||
double now = timef();
|
||||
while (s_active_thread_count > 0) {
|
||||
iothread_service_completion();
|
||||
}
|
||||
double after = timef();
|
||||
printf("(Waited %.02f msec for %d thread(s) to drain)\n", 1000 * (after - now), thread_count);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user