/** * Purges Tasks where this component is scheduler or schedulee from the TaskQueue. */ void purgeTasks (void *comp) { #ifdef MULTI_MONKS pthread_mutex_lock(&task_mutex); #endif Task *T = taskQueue; Task **temp = &taskQueue; uint8_t i = 0; while(T != NULL) { if(T->schedulee == comp || T->scheduler == comp) { Log(LOG_SCHEDULER, "[pT] id %x\n", T->identifier); i ++; *temp = T->next; returnMessage((Message *) T->context); taskCompleted(T); T = *temp; } else { temp = &(T->next); T = T->next; } } #ifdef MULTI_MONKS pthread_mutex_unlock(&task_mutex); #endif }
/** * Appelé à la fin de conversion d'une image */ void Converter::convertFinished() { _countFinished++; emit imageHasFinished(_countFinished); if (_count < _list.size()) { launchProcess(_list[_count],_size); _count++; } if (_countFinished == _list.size()) { emit taskCompleted(); } }
void executeTasks () { Task *toExecute = retrieveTask(); Log(LOG_SCHEDINTF, "[executeTasks] Start\n"); while(toExecute != NULL) { Log(LOG_SCHEDINTF, "[executeTasks] Executing a task\n"); toExecute->function(toExecute->schedulee, toExecute->context, toExecute->scheduler); returnMessage(toExecute->context); taskCompleted(toExecute); Log(LOG_SCHEDINTF, "[executeTasks] Task execution done\n"); toExecute = retrieveTask(); } Log(LOG_SCHEDINTF, "[executeTasks] End\n"); }
AnalyzeTask::~AnalyzeTask(void) { emit taskCompleted(m_taskId); }