Пример #1
0
void Worker()
{
    unsigned wnum;
    int curr = 0, i, last;
    int tasknum;
    TaskElement *task;
    TaskElement *taskhead;
    taskhead = gMem->tasks;
    while(1) {
        if(PopWork(&task) == DONE) break;
        QuickSort(task->left, task->right);
        LocalTaskStack[++LocalStackTop]=task-taskhead;
    }
}
Пример #2
0
//
//	void Worker(void);
//  this is the entry point of the parallel PThread work, dealing with care
//  
void Worker(void){
    int curr = 0, i, last;
    TaskElement task;

    for (;;) {
		// Continuously get a sub-array and sort it
		if (PopWork(&task) == DONE) {
			break;
		}

		QuickSort(task.left, task.right);
    }

    if (debug) {
    	fprintf(stderr,"\t%d: DONE.\n", Tmk_proc_id);
    }

}