English 中文(简体)
Is the linux kernel s list.h thread safe?
原标题:

Is the linux kernel s list.h thread safe?

最佳回答

No, the list_head struct doesn t contain any lock, and the operations are by no means atomic.

You can see so for yourself here, there is no mention of locking mechanisms etc.

问题回答

Just read the implementation; the answer is clearly NO in the presence of writers. (Multiple readers on immutable data is safe.)

Paul McKenney gives an introduction to RCU on the ever-helpful LWN, from which you can glean some tips on managing thread-safe updates to linked lists. Of course, your usage may be simple enough that spinlocks will suffice.





相关问题
Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Is reading from an XmlDocument object thread safe?

I was wondering if i could safely read from an XmlDocument object using SelectNodes() and SelectSingleNode() from multiple threads with no problems. MSDN says that they are not guaranteed to be ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签