Author: tjansen Date: Mon Oct 19 11:51:36 2009 New Revision: 1226 Log: Renamed pipefd to pipe_sched, also fixed two comments. Modified: trunk/libpisa/scheduler.c Modified: trunk/libpisa/scheduler.c ============================================================================== --- trunk/libpisa/scheduler.c Mon Oct 19 11:35:50 2009 (r1225) +++ trunk/libpisa/scheduler.c Mon Oct 19 11:51:36 2009 (r1226) @@ -40,7 +40,7 @@ /** * Pipe indicates that the scheduler should wake up before the first task */ -static int pipefd[2]; +static int pipe_sched[2]; /** * Main function of the scheduler thread @@ -54,26 +54,26 @@ while (1) { FD_ZERO(&fds); - FD_SET(pipefd[0], &fds); + FD_SET(pipe_sched[0], &fds); - select(pipefd[0] + 1, &fds, NULL, NULL, &timeout); - if (FD_ISSET(pipefd[0], &fds)) { + select(pipe_sched[0] + 1, &fds, NULL, NULL, &timeout); + if (FD_ISSET(pipe_sched[0], &fds)) { /* Someone woke us up to reschedule, read the bytes */ char c; - read(pipefd[0], &c, 1); + read(pipe_sched[0], &c, 1); } pthread_mutex_lock(&mutex_list); gettimeofday(&now, NULL); if (head && pisa_time_before(&head->due, &now)) { - /* (at least) the first action is due now, raise the + /* At least the first action is due now, raise the * flag. As we have to reschedule afterwards, sleep * for a _long_ time. We don't care about tv_usec. */ *flag = 1; timeout.tv_sec = 1000000; } else { /* No action is due now, sleep until the head is due - * (or we are woken up for rescheduling). */ + * or we are woken up for rescheduling. */ *flag = 0; if (head) timersub(&head->due, &now, &timeout); @@ -98,7 +98,7 @@ flag = shared; - result = pipe(pipefd); + result = pipe(pipe_sched); if (result != 0) PISA_ERROR("Could not create pipe for scheduler.\n"); @@ -120,8 +120,8 @@ pthread_cancel(thread); pthread_join(thread, NULL); - close(pipefd[0]); - close(pipefd[1]); + close(pipe_sched[0]); + close(pipe_sched[1]); pthread_mutex_destroy(&mutex_list); @@ -194,7 +194,7 @@ } *flag = 0; - write(pipefd[1], "0", 1); + write(pipe_sched[1], "0", 1); } /** @@ -227,7 +227,7 @@ cur->next = task; } - write(pipefd[1], "0", 1); + write(pipe_sched[1], "0", 1); pthread_mutex_unlock(&mutex_list); @@ -246,7 +246,7 @@ pisa_sched_remove_internal(task); free(task); - write(pipefd[1], "0", 1); + write(pipe_sched[1], "0", 1); pthread_mutex_unlock(&mutex_list); }