|
From: <pa...@us...> - 2003-08-02 23:30:46
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv5224
Modified Files:
rtai_rtapi.c
Log Message:
Usage counter required
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rtai_rtapi.c 2 Aug 2003 19:37:18 -0000 1.9
--- rtai_rtapi.c 2 Aug 2003 23:30:43 -0000 1.10
***************
*** 63,66 ****
--- 63,68 ----
#define FIFO_MAGIC 10293
+ /* Usage counter so that we don't kill the periodic timer too soon */
+ static int usage_count = 0;
/* declare vsprintf() explicitly instead of including all of <stdio.h>,
***************
*** 123,126 ****
--- 125,131 ----
static int rtapi_exit(void)
{
+ if (usage_count != 0 ) {
+ rtapi_print(" Warning, you have %d task handlers active", usage_count);
+ }
rtapi_print("Removing RTAPI\n");
return RTAPI_SUCCESS;
***************
*** 170,173 ****
--- 175,181 ----
*taskptr = task;
+ /* increment the usage counter */
+ usage_count++;
+
return RTAPI_SUCCESS;
}
***************
*** 186,189 ****
--- 194,201 ----
task->magic = 0;
kfree(task);
+
+ /* decrement the usage counter */
+ usage_count--;
+
return RTAPI_SUCCESS;
}
***************
*** 257,268 ****
/* P.C.
! Added these two lines to release the 8254 IRQ and stop the timer
as it was causing a kernel panic after removing rtai_sched.
- May well need to impliment a task counter to prevent the timer
- being stopped if calls are made to rtapi_task_stop() by other
- realtime tasks (Do we need a Fix Me here ?).
*/
! rt_reset_irq_to_sym_mode(TIMER_8254_IRQ);
! rt_free_timer();
retval = rt_task_delete(&(task->ostask));
--- 269,279 ----
/* P.C.
! Added these lines to release the 8254 IRQ and stop the timer
as it was causing a kernel panic after removing rtai_sched.
*/
!
! if (usage_count == 0) {
! rt_free_timer();
! }
retval = rt_task_delete(&(task->ostask));
|