visual c++ - Using static boolean vs. critical section for concurrency -
So I am preparing a new software interface for a USB HID device and I have a question about concurrency protection is. I think I have to add compatibility security to call ReadFile and WriteFile (Please make me wrong if it can be told from different threads of my design)
In the past, To apply the static booleans are used, until 1 boom adds a loop, as long as the bool did not indicate that the code was safe to enter. I have also used the Critical Section. Can anyone tell me that Critical Section is basically better with the use of Stable Bull, I know that I do not have a waiting loop code, but what is the polling for lock status? Rate Use in VC ++? Are they accustomed to the OS in some way so that they can be made better? Is using a boole not always safe to check a confluence? e.t.c.
I do not know much about C ++, but the association is usually not is implemented by voting, and generally the polling waste processor should not waste time and energy. Blocking on one lock, probably from time to time. Lock-free primitive, most likely or comparison-and-set or comparison-and-swap These approaches are supported by both specific modern hardware. They move towards very different "flavors" of interaction. Writing of a lockless data structure is best left to the experts (they are complex, and, more importantly, it is difficult to see if they are right and whether they guarantee the progress in the face of the dispute. ? Details usually accompany the pages of evidence) Fortunately, you can get library of them, and they should be behaved faster and better than blocking them in many people Received, but not in all cases.
Comments
Post a Comment