After reading the Test-and-Set Wikipedia entry, I am still left with the question ‘What would a Test-and-Set be used for?’
I realize that you can use it to implement Mutex (as described in wikipedia), but what other uses does it have?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You use it any time you want to write data to memory after doing some work and make sure another thread hasn’t overwritten the destination since you started. A lot of lock/mutex-free algorithms take this form.