On 9 March 2013 01:27, Kalle Valo <kvalo@xxxxxxxxxxxxxxxx> wrote: > I think to fix the race the queue should be consumed something like > this (pseudo code): > > lock() > while (!list_empty()) { > entry = list_first_entry() > unlock() > > do_stuff() > > lock() > } Well, sure, but you should then re-check all the state that may have changed when you reacquire that lock. :-) Another way of doing it is: init temp list lock() copy list to temp list unlock() while (! temp list empty) { do_stuff() } That way you don't have that constant unlock/relock going on. Adrian -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html