sched: make sure scheduler parameter change handler is first
This is needed to allow other handlers to add new timers.
This commit is contained in:
parent
58b211d707
commit
0bdac2c7b3
3 changed files with 15 additions and 0 deletions
8
local.c
8
local.c
|
@ -252,6 +252,14 @@ void LCL_RemoveParameterChangeHandler(LCL_ParameterChangeHandler handler, void *
|
|||
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
LCL_IsFirstParameterChangeHandler(LCL_ParameterChangeHandler handler)
|
||||
{
|
||||
return change_list.next->handler == handler;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
invoke_parameter_change_handlers(struct timeval *raw, struct timeval *cooked,
|
||||
double dfreq, double doffset,
|
||||
|
|
3
local.h
3
local.h
|
@ -92,6 +92,9 @@ extern void LCL_AddParameterChangeHandler(LCL_ParameterChangeHandler handler, vo
|
|||
/* Remove a handler */
|
||||
extern void LCL_RemoveParameterChangeHandler(LCL_ParameterChangeHandler, void *anything);
|
||||
|
||||
/* Check if a handler is invoked first when dispatching */
|
||||
extern int LCL_IsFirstParameterChangeHandler(LCL_ParameterChangeHandler handler);
|
||||
|
||||
/* Function type for handlers to be called back when an indeterminate
|
||||
offset is introduced into the local time. This situation occurs
|
||||
when the frequency must be adjusted to effect a clock slew and
|
||||
|
|
4
sched.c
4
sched.c
|
@ -514,6 +514,10 @@ handle_slew(struct timeval *raw,
|
|||
int i;
|
||||
|
||||
if (change_type != LCL_ChangeAdjust) {
|
||||
/* Make sure this handler is invoked first in order to not shift new timers
|
||||
added from other handlers */
|
||||
assert(LCL_IsFirstParameterChangeHandler(handle_slew));
|
||||
|
||||
/* If a step change occurs, just shift all raw time stamps by the offset */
|
||||
|
||||
for (ptr = timer_queue.next; ptr != &timer_queue; ptr = ptr->next) {
|
||||
|
|
Loading…
Reference in a new issue