[PD-cvs] pd/src m_sched.c,1.5.4.24,1.5.4.25
Tim Blechmann
timblech at users.sourceforge.net
Tue Apr 19 16:28:06 CEST 2005
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21196
Modified Files:
Tag: devel_0_38
m_sched.c
Log Message:
clean up of idle callbacks
Index: m_sched.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v
retrieving revision 1.5.4.24
retrieving revision 1.5.4.25
diff -C2 -d -r1.5.4.24 -r1.5.4.25
*** m_sched.c 19 Apr 2005 12:35:28 -0000 1.5.4.24
--- m_sched.c 19 Apr 2005 14:28:03 -0000 1.5.4.25
***************
*** 645,697 ****
}
- #if 0 /* old version, todo: profiling */
- static t_sched_callback * idle_callback = NULL;
-
- static void run_idle_callbacks(int microsec)
- {
- if (idle_callback == NULL)
- idle_callback = (t_sched_callback*) fifo_get(callback_fifo);
-
- if (idle_callback != NULL)
- {
- double remain;
- double stop = sys_getrealtime()*1.e6 + microsec;
- do
- {
- int status = (idle_callback->function)(idle_callback->argv);
- remain = stop-sys_getrealtime()*1.e6;
-
- switch (status)
- {
- /* callbacks returning 0 will be deleted
- * beware: if a callback never returns zero, it will run until the end of time,
- * blocking other callbacks */
- case 0:
- freebytes (idle_callback->argv, idle_callback->argc);
- freebytes ((void*)idle_callback, sizeof(t_sched_callback));
- idle_callback = fifo_get(callback_fifo);
-
- /* callbacks returning 1 will be run again */
- case 1:
- break;
-
- /* callbacks returning 2 will be run during the next idle callback */
- case 2:
- goto sleep;
- }
- }
- while ((idle_callback != NULL) && (remain > 0));
-
- sleep:
- /* sleep for the rest of the time */
- if(remain > 100)
- sys_microsleep(remain);
- }
- else
- sys_microsleep(microsec);
- }
-
- #else /* improved ringbuffer version */
static t_sched_callback *ringbuffer_head;
--- 645,649 ----
***************
*** 761,770 ****
/* sleep for the rest of the time */
! /* if(remain > 100) // T.Grill: we must sleep here even if only a bit - where else? */
! sys_microsleep(remain);
}
else
sys_microsleep(microsec);
}
- #endif
/* } tb */
--- 713,720 ----
/* sleep for the rest of the time */
! sys_microsleep(remain);
}
else
sys_microsleep(microsec);
}
/* } tb */
More information about the Pd-cvs
mailing list