Is there any windows API (application program interface) to execute thread on atomic mode?

  • 2
    What's "atomic mode"?
    – conio
    Apr 28, 2016 at 14:09
  • execute operation without context switch May 3, 2016 at 5:54
  • Obviously Not. That's what preemptive multitasking (in contrast to cooperative multitasking) means. Preemption means the operating system may preempt your thread at any moment (for any reason or for no reason at all as far as you're concerned), and it actually does.
    – conio
    May 3, 2016 at 8:55

1 Answer 1


The Interlocked API may be what you are looking for. Or more generally, here is the MSDN topic on synchronization.

Not the answer you're looking for? Browse other questions tagged or ask your own question.