mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-25 09:26:27 -05:00
Document why thread_yield is used
This commit is contained in:
parent
5a8a851a70
commit
cd044f6e21
1 changed files with 9 additions and 1 deletions
10
cmdline/io.c
10
cmdline/io.c
|
|
@ -557,7 +557,15 @@ static void io_flush_thread(struct snapraid_io* io)
|
||||||
if (all_done)
|
if (all_done)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* wait for something to complete */
|
/*
|
||||||
|
* Wait for something to complete.
|
||||||
|
*
|
||||||
|
* We cannot use thread_cond_wait(&io->write_done) here because
|
||||||
|
* write_done is heavily optimized to only be signaled when the oldest
|
||||||
|
* task in the queue completes (done_index == waiting_index).
|
||||||
|
* Since io_flush waits for all tasks to complete, it would miss
|
||||||
|
* wakeups for newer tasks and deadlock.
|
||||||
|
*/
|
||||||
thread_yield();
|
thread_yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue