153 |
{ |
{ |
154 |
r = select (n, readfds, writefds, exceptfds, timeout ? &delay : NULL); |
r = select (n, readfds, writefds, exceptfds, timeout ? &delay : NULL); |
155 |
|
|
156 |
if (r != -1 || errno != EINTR) |
if (r < 0 && errno != EINTR) |
157 |
|
return -errno; |
158 |
|
else if (r >= 0) |
159 |
return r; |
return r; |
160 |
|
|
161 |
/* Here we know we got EINTR. */ |
/* Here we know we got EINTR. */ |
162 |
if ((*env)-> |
if ((*env)-> |
163 |
CallStaticBooleanMethod (env, thread_class, thread_interrupted)) |
CallStaticBooleanMethod (env, thread_class, thread_interrupted)) |
164 |
{ |
{ |
165 |
return EINTR; |
return -EINTR; |
166 |
} |
} |
167 |
|
|
168 |
if (timeout) |
if (timeout) |
249 |
helper_select (env, thread_class, thread_interrupted, max_fd + 1, |
helper_select (env, thread_class, thread_interrupted, max_fd + 1, |
250 |
&read_fds, &write_fds, &except_fds, time_data); |
&read_fds, &write_fds, &except_fds, time_data); |
251 |
|
|
252 |
if (result == EINTR) |
if (result == -EINTR) |
253 |
{ |
{ |
254 |
/* The behavior of JRE 1.4.1 is that no exception is thrown |
/* The behavior of JRE 1.4.1 is that no exception is thrown |
255 |
* when the thread is interrupted, but the thread's interrupt |
* when the thread is interrupted, but the thread's interrupt |
270 |
|
|
271 |
if (result < 0) |
if (result < 0) |
272 |
{ |
{ |
273 |
if (strerror_r (errno, message_buf, BUF_SIZE)) |
|
274 |
|
int errorcode = -result; |
275 |
|
|
276 |
|
if (strerror_r (errorcode, message_buf, BUF_SIZE)) |
277 |
{ |
{ |
278 |
/* This would mean that message_buf was to small |
/* This would mean that message_buf was to small |
279 |
* to hold the error message. |
* to hold the error message. |