Signals in Unix Solaris

I am doing a project to stimulate the scheduing policy of an OS under Unix Solaris.

Its something like that:

A process, say A will communicate to another process, which is the OS, and then execute the system call, pause();

The stimulated OS will then have to use sigsend(); to send a SIGCONT signal to wake process A up. And OS can also use sigsend() to send a SIGSTOP signal to suspend process A.

Now, my problem is that I cant get SIGCONT to work. Whenever I do a SIGSTOP, the process gets suspended and moved to the background. So even after SIGCONT, that process does not continue on the shell where it got started (console).

SIGCONT also does not wake the process up when I first called it. pause() should block a process until it gets a signal (in this case SIGCONT).

Am I using SIGCONT correctly? If not how should I use it?

Thanks in advance.

No, I would not expect that to work. You can use SIGSTOP and SIGCONT to suspend and resume a background process or a daemon safely. But only the shell should send these signals to a foreground process. It has to keep track of who it is the foreground.

After a shell puts a job in the foreground, it issues a wait(). It expects that the wait() will return when the program exits(). But it will also return if the process is stopped. When you sent the SIGSTOP the shell probably thought that the process exited and lost track of it. I would kinda expect a job control shell to be a little smarter than that. But you are throwing it a curve.