multithreading - Thread-safety in C? -
i want write high performance synchronized generator in c. want able feed events , have multiple threads able poll/read asynchronously, such threads never receive duplicates.
i don't know how synchronization typically done. can give me high level explanation of 1 or more techniques might able use?
thanks!
the main concept in thread safety mutex (though there different kind of locks). used protect memory multiple accesses , race conditions.
a example of use when using linked list. can't allow 2 different threads modify in same time. in example, possibly use linked-list create queue, , each thread consume data it.
obviously there other synchronization mechanisms, 1 (by far ?) important.
you have @ this page (and referenced pages @ bottom) more implementation details.
Comments
Post a Comment