0

I need to perform part of some code atomically. I tried to search for information and I didn't get a specific answer.

lets say the code is:

//ATOMIC
unlock A
lock B
//ATOMIC END
  • Is it possible to make this operation atomic in c ?
  • Does it depends on my processor?
  • Is there any simple function who does that?
  • (These instructions are on the user side)

Thanks

hudac
  • 2,584
  • 6
  • 34
  • 57
  • http://stackoverflow.com/questions/1130018/unix-portable-atomic-operations – Geesh_SO Feb 16 '13 at 11:21
  • @Geesh_SO , I'm not sure how to use this. I want to make `unlock A + lock B` atomic. I don't want to do `add` or `sub` ... – hudac Feb 16 '13 at 12:39
  • I don't believe there are, atomic lock/unlock sounds a bit strange. Maybe if you described your actual use case someone could help you. – Mat Feb 16 '13 at 16:43

0 Answers0