It's hard to answer your question because it's not clear what do you mean under "pause".
What pausing is not
If this is a WinForms application for example, you should have a UI window. This window has many objects stored deep in Windows kernel. (This is why actually it is difficult to make Windows a console-only OS, Microsoft only done this for new 2012 server editions). There is a global message loop that dispatches messages to all windows. This is how you actually see everything on your desktop. Surely you don't want to pause that message loop, which effectively halts Windows and results in undefined behavior/BSOD/system hanging state...
What it is
You probably thinking about pausing some user-level code that your application executes. In this case you can use some asynchronicity here.
Let's assume you do heavy prime number calculations and at some moment want to pause/resume that.
Important! You should do such work on a separate thread, keeping UI thread available for handling display notifications from Windows kernel.
From time to time, user can click on a UI element, which works in the UI thread, and then you can dispatch a pause/resume action to the worker thread.
Arsenal
You could use ManualResetEvent
or AutoResetEvent
. These classes are specifically designed to pass notifications between threads and as a consequence remove thread (which doesn't need to do any work) from Windows Task Scheduler.
You can think of the reset events as lights switches. When you want some work to be done, you switch it ON. If you want to pause, you switch it OFF. When the *ResetEvent
is in the "OFF" state, it doesn't consume any CPU and it doesn't perform any work.