--- libaitsched/src/hooks.c 2012/08/02 13:56:19 1.11 +++ libaitsched/src/hooks.c 2012/08/08 08:25:39 1.12 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.11 2012/08/02 13:56:19 misho Exp $ +* $Id: hooks.c,v 1.12 2012/08/08 08:25:39 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -550,7 +550,7 @@ sched_hook_fetch(void *root, void *arg __unused) sched_timespecinf(&r->root_wait); } #else - if (!TAILQ_FIRST(&r->root_eventlo) && (task = TAILQ_FIRST(&r->root_timer))) { + if (!TAILQ_FIRST(&r->root_task) && (task = TAILQ_FIRST(&r->root_timer))) { clock_gettime(CLOCK_MONOTONIC, &now); m = TASK_TS(task); @@ -561,8 +561,8 @@ sched_hook_fetch(void *root, void *arg __unused) sched_timespecinf(&r->root_wait); } #endif - /* if present member of eventLo, set NOWAIT */ - if (TAILQ_FIRST(&r->root_eventlo)) + /* if present member of task, set NOWAIT */ + if (TAILQ_FIRST(&r->root_task)) sched_timespecclear(&r->root_wait); if (r->root_wait.tv_sec != -1 && r->root_wait.tv_nsec != -1) @@ -957,18 +957,18 @@ sched_hook_fetch(void *root, void *arg __unused) #endif } - /* put eventlo priority task to ready queue, if there is no ready task or - reach max missed fetch-rotate */ - if ((task = TAILQ_FIRST(&r->root_eventlo))) { - if (!TAILQ_FIRST(&r->root_ready) || r->root_eventlo_miss > MAX_EVENTLO_MISS) { - r->root_eventlo_miss = 0; + /* put regular task priority task to ready queue, + if there is no ready task or reach max missing hit events */ + if ((task = TAILQ_FIRST(&r->root_task))) { + if (!TAILQ_FIRST(&r->root_ready) || r->root_task_miss > r->root_miss) { + r->root_task_miss ^= r->root_task_miss; #ifdef HAVE_LIBPTHREAD - pthread_mutex_lock(&r->root_mtx[taskEVENTLO]); + pthread_mutex_lock(&r->root_mtx[taskTASK]); #endif - TAILQ_REMOVE(&r->root_eventlo, task, task_node); + TAILQ_REMOVE(&r->root_task, task, task_node); #ifdef HAVE_LIBPTHREAD - pthread_mutex_unlock(&r->root_mtx[taskEVENTLO]); + pthread_mutex_unlock(&r->root_mtx[taskTASK]); #endif task->task_type = taskREADY; #ifdef HAVE_LIBPTHREAD @@ -979,9 +979,9 @@ sched_hook_fetch(void *root, void *arg __unused) pthread_mutex_unlock(&r->root_mtx[taskREADY]); #endif } else - r->root_eventlo_miss++; + r->root_task_miss++; } else - r->root_eventlo_miss = 0; + r->root_task_miss ^= r->root_task_miss; /* OK, lets get ready task !!! */ task = TAILQ_FIRST(&r->root_ready);