Help me to change from mutex to swap solution please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me to change from mutex to swap solution please.

https://code.sololearn.com/cgtLB75P8II1/?ref=app I've used pthread_mutex solution in this code to solve critical section problem. How I can use swap solution in the same code. I did it many times but didn't work with me. Can any one help me please?! https://code.sololearn.com/cgtLB75P8II1/?ref=app

15th Apr 2021, 12:55 AM
hanan alhinai
hanan alhinai - avatar
5 Answers
0
https://code.sololearn.com/cTwgO21bkXwK/?ref=app
15th Apr 2021, 10:59 AM
hanan alhinai
hanan alhinai - avatar
15th Apr 2021, 1:35 PM
hanan alhinai
hanan alhinai - avatar
0
Can you show me how can I define TestAndSet and lock
15th Apr 2021, 1:41 PM
hanan alhinai
hanan alhinai - avatar
0
Ok, thank you very much
15th Apr 2021, 1:45 PM
hanan alhinai
hanan alhinai - avatar
0
It's OK, You've helped me a lot by caring.
15th Apr 2021, 1:55 PM
hanan alhinai
hanan alhinai - avatar