Whenever your program stops under GDB for any reason, all threads of execution stop, not just the current thread. This allows you to examine the overall state of the program, including switching between threads, without worrying that things may change underfoot.
Conversely, whenever you restart the program, all threads start executing. This is true even when
In particular, GDB cannot
You might even find your program stopped in another thread after continuing or even
On some OSes, you can lock the OS scheduler and thus allow only a single thread to run.
set
show
70 Stopping and Continuing