#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <getopt.h>
#include <execinfo.h>
RT_TASK task;
void task_body (void *cookie)
{
for (;;) {
printf("Switched to secondary mode\n");
}
}
void warn_upon_switch(int sig __attribute__((unused)))
{
void *bt[32];
int nentries;
nentries = backtrace(bt,sizeof(bt) / sizeof(bt[0]));
backtrace_symbols_fd(bt,nentries,fileno(stdout));
}
int main (int argc, char **argv)
{
int err;
signal(SIGXCPU, warn_upon_switch);
if (err)
{
fprintf(stderr,"failed to create task, code %d\n",err);
return 0;
}
if (err)
{
fprintf(stderr,"failed to start task, code %d\n",err);
return 0;
}
pause();
return 0;
}