프로그램 잠시 멈추고 다시 동작하게 하기

c로 프로그램을 짜고 있습니다. 프로그램을 잠시 멈추었다가 쓰레드에서
어떤 시그널을 주면 프로그램이 다시 동작하게 하고자 합니다.
sigaction이 있던데, 잘 안되네여...
man에 다음과 같이 되어 있네여..
signum 는 시그널을 명시하고, SIGKILL 그리고
SIGSTOP을제외하고는타당한시그널이될수있다.
그렇다고 pause를 사용하면 멈추는건 되는데 다시 시작하는게 안되고요(제
가 모르는 건지.흠..))
#include
#include
void *thread_function()
{
int res;
printf(" thread_function start\n");
//sleep(5);
res=sigaction(SIGCONT,NULL,NULL);
if(res!=0)
{
printf("siaction continue error\n");
}
printf(" thread_function end\n");
}
int main()
{
pthread_t a_thread;
void *thread_result;
int res;
res=pthread_create(&a_thread,NULL,thread_function,NULL);
if(res!=0)
{
printf("thread create fial\n");
}
res=sigaction(SIGSTOP,NULL,NULL);
if(res!=0)
{
printf("sigaction stop fail\n");
}
printf("process wake up\n");
}
제가 무엇을 잘못했는지 알고 싶습니다. 수고하세요
댓글 달기