Hi
I'm using vxwork's API.
Is SIGXCPU signal sent when primary to seconday VxWorks task's mode switch
? If it's the case, which implementation would work ?
Use of signal (native Xenomai API) :
void vx_task_create(...)
{
...
signal(SIGXCPU, xe_signal_thread);
...
}
void *xe_signal_thread (void *sig_caught)
{
/* Mode switching warning */
}
There is missing rt_task_set_mode(0, T_WARNSW, NULL); which I don't
know where I have to put it because I want all the task to warn in case of
a mode switch and I don't what to write this sentense in each task's body
routine.
Use of pthread_sigmask
static sigset_t sigusr1Mask;
void vx_task_create(...)
{
...
sigemptyset(&sigusr1Mask);
sigaddset(&sigusr1Mask,SIGXCPU);
...
}
void vx_task_start(...) {
...
pthread_sigmask (SIG_BLOCK, &sigusr1Mask, NULL);
pthread_create (&sig_thr_id, NULL, xe_signal_thread, NULL);
...
}
void *xe_signal_thread (void *arg)
{
int sig_caught; /* signal caught */
sigwait (&signal_mask, &sig_caught);
switch (sig_caught)
{
case SIGXCPU: /* process SIGXCPU */
/* Mode switching warning */
fprintf (stderr, "\nPrimary to secondary mode switch %d\n",
sig_caught);
break;
default: /* should normally not happen */
fprintf (stderr, "\nUnexpected signal %d\n", sig_caught);
break;
}
}
In this case, a thread waiting for the signal will be created with
each task, I don't thing it's necessary !!
On last thing, how can I force a vxworks task switching in primary mode,
like in the native API rt_task_set_mode(0, T_WARNSW, NULL);
Thank's in advance
Matthieu
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help