mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Document why thread_yield is used
This commit is contained in:
parent
056a037761
commit
dcb7327f15
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)
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue