> POSIX cleaning ^.^ on real time What if I signal to dead thread?
> Nice to question again fellas. How you been!
>
> Lately, I control the signal actions in threads on Vxworks.
> I don't know how VxWorks library do the things insightly but Experts
> sir!!
> please answer my question.
Try comp.os.vxworks.
~Dave~
Reply by ahtz●July 11, 20062006-07-11
POSIX cleaning ^.^ on real time What if I signal to dead thread?
Nice to question again fellas. How you been!
Lately, I control the signal actions in threads on Vxworks.
I don't know how VxWorks library do the things insightly but Experts
sir!!
please answer my question.
void *test(void *data)
{
int i ;
tempo temp; // tempo is just a class
struct sigaction action;
action.sa_handler = tempo::signal_handler;
sigaction( SIGSTOP_TERMINAL_SERVICE, &action, NULL );
pthread_cleanup_push(tempo::real_cleanup,(void*)(&temp));
cout<<"middle"<<endl;
while(1)
{
printf("*** %d %d\n", (int)pthread_self(),i);
i++;
sleep(1);
if( i == 5 ){
pthread_cleanup_pop(0);
return (void*)0;
}
}
pthread_cleanup_pop(0);
return (void*)0;
}
and now I will kill the thread by signaling.
thread_t[] is the array of thread id. (pthread_t)
pthread_kill(thread_t[0],SIGSTOP_TERMINAL_SERVICE);
pthread_kill(thread_t[1],SIGSTOP_TERMINAL_SERVICE);
and... kill again
pthread_kill(thread_t[0],SIGSTOP_TERMINAL_SERVICE);
pthread_kill(thread_t[1],SIGSTOP_TERMINAL_SERVICE);
of course the error occurs. thread_t[0] and [1] no more exist.
But The thing I want to know is that if the thread's dead,
what's gonna happen in signal things written in the middle of the
thread function.
They're - thread cleanup function and signal handler function -
registered by
sigaction and the pthread_cleanup_push.
Registered and Fired when thread function is out??
What is the work kernel does for registered sigaction ?