Skip to content

Commit

Permalink
fix issue eclipse-omr#106
Browse files Browse the repository at this point in the history
close_wrapper() now properly handles EINTR.
The return value of setup_native_thread() is now used properly.
The workaround for an ancient scheduler bug is no longer used on Linux.

Signed-off-by: Keith W. Campbell <[email protected]>
  • Loading branch information
keithc-ca committed May 10, 2016
1 parent cd53be7 commit 927091b
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions port/unix/omrintrospect.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,19 @@ struct PlatformWalkData {
barrier_r release_barrier;
};


/* Wrapper for the close function that checks we're not closing stdin,stdout or stderr and
* retries on EINTR.
*/
/* Wrapper for the close function that retries on EINTR. */
static int
close_wrapper(int fd)
{
if (fd != -1) {
int rc = 0;
do {
close(fd);
} while (rc == EINTR);
int rc = 0;

return rc;
if (-1 != fd) {
do {
rc = close(fd);
} while ((0 != rc) && (EINTR == errno));
}

return 0;
return rc;
}

/*
Expand Down Expand Up @@ -1685,7 +1681,7 @@ omrintrospect_threads_nextDo(J9ThreadWalkState *state)
goto cleanup;
}

#if defined(LINUX) || defined(AIXPPC) || defined(J9ZOS390)
#if defined(AIXPPC) || defined(J9ZOS390)
do {
result = sem_trywait_r(&data->controller_sem);
/* linux seems to have a scheduler bug whereby a process with all threads in system waits doesn't get scheduled
Expand Down Expand Up @@ -1743,7 +1739,8 @@ omrintrospect_threads_nextDo(J9ThreadWalkState *state)

data->consistent = 1;

if (setup_native_thread(state, NULL, 0) != 0) {
result = setup_native_thread(state, NULL, 0);
if (0 != result) {
RECORD_ERROR(state, ALLOCATION_FAILURE, result);
goto cleanup;
}
Expand Down

0 comments on commit 927091b

Please sign in to comment.