|
From: <jmk...@us...> - 2003-08-11 04:58:42
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv13330/examples/timertask
Modified Files:
timertask.c
Log Message:
added error recovery and cleanup to rtai_rtapi
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** timertask.c 10 Aug 2003 23:52:35 -0000 1.8
--- timertask.c 11 Aug 2003 04:58:39 -0000 1.9
***************
*** 37,49 ****
int timer_prio;
! /* init is still in a state of change - right now this isn't needed
! if (0 != rtapi_app_init()) {
return -1;
}
- */
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval != RTAPI_SUCCESS ) {
/* See rtapi.h for the error codes returned */
rtapi_print( "timertask init: rtapi_clock_set_period returned %d\n", retval );
--- 37,47 ----
int timer_prio;
! if (rtapi_init() != RTAPI_SUCCESS ) {
return -1;
}
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval < 0 ) {
/* See rtapi.h for the error codes returned */
rtapi_print( "timertask init: rtapi_clock_set_period returned %d\n", retval );
***************
*** 60,63 ****
--- 58,62 ----
if ( retval != RTAPI_SUCCESS ) {
/* See rtapi.h for the error codes returned */
+ rtapi_print( "timertask init: rtapi_task_new returned %d\n", retval );
return -1;
}
***************
*** 69,73 ****
0, timer_prio,
TIMER_STACKSIZE,
! TASK_PERIOD_NSEC, NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
--- 68,72 ----
0, timer_prio,
TIMER_STACKSIZE,
! TASK_PERIOD_NSEC, RTAPI_NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
***************
*** 95,108 ****
}
/* Remove the task from the list */
retval = rtapi_task_delete( timer_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
return;
! }
/* Print the final count just to show that the task did it's job */
rtapi_print("timertask exit: timer count is %d\n", timer_count);
/* Clean up and exit */
! rtapi_app_return();
}
--- 94,109 ----
}
/* Remove the task from the list */
+
+ /* TESTING - intentionally skip the task_delete
retval = rtapi_task_delete( timer_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
return;
! }*/
/* Print the final count just to show that the task did it's job */
rtapi_print("timertask exit: timer count is %d\n", timer_count);
/* Clean up and exit */
! rtapi_exit();
}
|