/*
file name:a.c
date : Wed 26 Jan 2022 04:13:05 AM EST
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <pthread.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <signal.h>
static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
void task_sighandler(int sig)
{
pthread_mutex_t mutex = {0};
if(SIGUSR1 != sig)
{
/* null */
}
else
{
/* stop task */
pthread_cond_wait( &cond, &mutex);
}
}
void *task (void *arg)
{
signal(SIGUSR1, task_sighandler);
while(1)
{
printf("%s runing.\n", __func__);
usleep(500*1000);