Please don't top-post. On Wed, 2011-06-22 at 14:51 +0200, Manuel Sáez wrote: > Yes, I probably need some kind of mutex, but I was wondering if it > would be enough with some memory barrier, since read and write > operations in modern computers are usually atomics. > > What I pretend to do is that everytime I read one element from the > list, the function changes the "head pointer" with the next element , > so the next time the function is called, it will return the next > element. When the list reach the last element, it starts again from > the beggining. The function should somehow remember the last extracted > element each time and consecutively return the next one. I could > probably use a counter and iterate the list looking for the next > element, but it would be hard to maintain when some elements are added > or deleted. Well ... you'd need to synchronize that offset or whatever, and also reset whenever you modify the list, or whatever. It doesn't seem feasible. I suggest you try implementing what you want first, and then maybe somebody can help you optimise it. johannes -- 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