I try to use setitimer(ITIMER_PROF, &tick, NULL) to limit the cpu time consuming by the process. But if the process turns to suspend (in my case ,the process sinks into a dead loop, then the Ubuntu16.04 suspends it and does not wake up it again), the timer cannot kill the process.
If I use:
setitimer(ITIMER_PROF, &tick1, NULL);
setitimer(ITIMER_REAL, &tick2, NULL);
to limit a bigger real time. The man page said the later setitimer will overwrite the former.
How can I use setitimer to limit the process time, both on cpu time and real time ?