C++ wait for SIGTERM/SIGKILL

I've got a service that can get self uninstall command. In this case It should call the uninstall command from the generic commandHandler that may handle many other commands.

After receiving the uninstall command, I'd like to halt the current thread from handling any additional commands.

void ExecuteUninstall() {
  uninstallBackground();
  do { sleep(100); } while(1); // wait idle.
}

I was wondering if there's any better approach for waiting for the process to terminate itself ? Until the process is removed externally, the process should continue running except for this thread ... so an alternative solution could be to kill this thread from within. and leave the other threads functioning.

Thanks !

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum