Reputation: 30805
I want to suspend (pause) a forked process at startup and resume it later on. Is there any way to do that with POSIX or Solaris.
Upvotes: 0
Views: 957
Reputation: 30805
I did it by using a semaphore and a signal handler. To wake up the child, the parent process sends a signal to the child process which in turn posts the semaphore from within the signal handler. The child, which was waiting on that semaphore, then wakes up.
Upvotes: 0
Reputation: 11108
Why not just call pause()
in code of child process after fork?
Upvotes: 4
Reputation: 95579
You could send your process SIGSTOP
, then resume with SIGCONT
.
Upvotes: -1