Messages in this thread | | | Date | Tue, 8 Feb 2011 11:33:21 -0800 | From | Dmitry Torokhov <> | Subject | Re: [PATCH 1/2] misc: add CARMA DATA-FPGA Access Driver |
| |
On Tue, Feb 08, 2011 at 11:11:44AM -0800, Ira W. Snyder wrote: > On Tue, Feb 08, 2011 at 09:50:29AM -0800, Dmitry Torokhov wrote: > > On Tue, Feb 08, 2011 at 09:20:46AM -0800, Ira W. Snyder wrote: > > > > > Go back and re-think my loop. This is a > > > common idiom straight of out LDD3 pages 153-154. > > > > > > You should note that it is only possible to exit the loop with the lock > > > held AND !list_empty(used). The lock protects the used list, and > > > therefore, there must be a buffer on the list. > > > > No, because you are woken up while not holding the lock so another > > reader is free to take it off the list. > > > > Correct. But then I go around the loop and check list_empty() again > before exiting the loop. The list MUST NOT be empty before the loop will > terminate.
Yes, you are right, I competely missed the fact that we'd loop around and check the condition again. I'll go grab another coffee now.
-- Dmitry
| |