↧
Answer by Gabriel Staples for Atomic swap in C
I think this is worth presenting up front. This spin lock approach I'm about to present is valid and correct, but it is also scheduler-unaware, meaning that it won't cooperate with the scheduler like a...
View ArticleAnswer by Jens Gustedt for Atomic swap in C
It depends a bit on your architecture, what is effectively and efficiently possible. In any case you would need that the two pointers that you want to swap be adjacent in memory, the easiest that you...
View ArticleAtomic swap in C
I think I'm missing something obvious here. I have code like this:int *a = <some_address>;int *b = <another_address>;// ...// desired atomic swap of addresses a and b hereint *tmp = a;a =...
View Article