lkml.org 
[lkml]   [2016]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectDescription of complete() is either misleading or there is a bug
The Description says "Threads will be awakened in the same order in
which they were queued."
Reading this the programmer may thing that it implies that the first
thread to get to wait_for_completion_timeout would also be the first
thread to proceed and this is incorrect, at least at the following
scenario:

thread A calls wait_for_completion_timeout and goes to sleep. when
complete is called it wakes up and completes execution of timeout =
action(timeout); in function do_wait_for_common. Now lets say that
another thread B calls wait_for_completion_timeout. now x->done is 1
so this thread sets x->done to 0 and goes on with its execution. Now
thread A continues its execution, it goes to the next line:

} while (!x->done && timeout);

and goes back to sleep. And so thread B executed first although thread
A started waiting first.

So either the Description is wrong or the implementation of
wait_for_completion_timeout and the functions it calls is wrong.

\
 
 \ /
  Last update: 2016-06-18 15:01    [W:0.041 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site