I am writing a video program in C in embedded linux.
My main function creates 2 threads.
All are with while loop.
(1)main loop is in charge with video processing
(2)thread 1 loop is in charge with User Interface
(2)thread 2 loop is in charge with statistic of video
My question is ,
How do i terminate this program by others normally with
thread 1 is with blocking function?( fgets is always waiting for user input )
( Our design is with this program could be terminated by other program. )
PS1. I tried to add a SIGINT callback function in this program.But this thread 1 is still pending there waiting fo user input even if i pass SIGINT to it...
PS2. "kill -9" make my program crash occasionally.
( don't know why...maybe thread 1 do not release
resources normally...
)
Any ideas for this?