Reputation: 814
I'm reading articles about multithreading from a university and in one of those articles in order to show that Atomic and Lock()/Unlock() operations are different it says that "locks can be used for purposes beyond atomicity" but it doesn't explain any further. Can someone please give a couple of examples of the cases that locks are used for non atomicity purposes?
Thanks
Upvotes: 1
Views: 57
Reputation: 171178
Locks are used most often for mutual exclusion. You can use locks even if you don't work on shared memory at all. For example, you might want to call a webservice with at most one parallel call.
Upvotes: 1