Skip to content

Commit

Permalink
chore: remove not working busy wait select
Browse files Browse the repository at this point in the history
dont compile qthreads in test env
Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
  • Loading branch information
king-11 committed Jul 29, 2021
1 parent 83ebb6d commit 67a6423
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions runtime/src/qio/sys.c
Expand Up @@ -1911,44 +1911,9 @@ err_t sys_select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds,
return err_out;
}

#ifdef QTHREAD_VERSION
#if defined(QTHREAD_VERSION) && !defined(CHPL_RT_UNIT_TEST)
got_nset = qt_select(nfds, readfds, writefds, exceptfds, timeout);
#else
// struct timeval deadline;
// struct timeval now;
// struct timeval real_timeout;
// long wait_usec = 5;

// if (timeout != NULL) {
// gettimeofday(&deadline, NULL);
// deadline.tv_sec += timeout->tv_sec;
// deadline.tv_usec += timeout->tv_usec;
// if (deadline.tv_usec > 1000000) {
// deadline.tv_sec++;
// deadline.tv_usec -= 1000000;
// }
// } else if (timeout->tv_sec == 0) {
// if (timeout->tv_usec < wait_usec)
// wait_usec = timeout->tv_usec;
// }

// real_timeout.tv_sec = 0;
// real_timeout.tv_usec = wait_usec;

// while (1) {
// // It would be nicer if the tasking layer supported a select
// // call and knew to wait in the select call if no task was waiting
// got_nset = select(nfds, readfds, writefds, exceptfds, &real_timeout);
// if (got_nset == -1) err_out = errno; // save error
// if (got_nset != 0) break; // exit loop if something happened
// #ifndef CHPL_RT_UNIT_TEST
// chpl_task_yield();
// #endif
// gettimeofday(&now, NULL);
// if (now.tv_sec > deadline.tv_sec ||
// (now.tv_sec == deadline.tv_sec && now.tv_usec > deadline.tv_usec))
// break;
// }
got_nset = select(nfds, readfds, writefds, exceptfds, timeout);
#endif
if (got_nset == -1) err_out = errno; // save error
Expand Down

0 comments on commit 67a6423

Please sign in to comment.