timeout - Limit execution time of function in c -
i limit execution of function in pure c, without stopping whole program.
i believe closest thing on stackoverflow.com on last comment of thread: how limit execution time of function in c/posix?
there talk of using setjmp , longjm placed after function limit in time, thread died.
is there knows if indeed possible?
cheers
i can see 2 options, first 1 check time every few lines of code , return
if it's much, don't think it's idea.
second, use threads. run 2 functions @ same time, 1 timing other, if time big kills first one. i'm pretty sure windows , linux have different libraries create threads try , use library works across platforms 1 maybe http://openmp.org/wp/.
i'm not familiar library , threads in general hope helps
Comments
Post a Comment