/[classpath]/classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c
ViewVC logotype

Diff of /classpath/native/jni/java-nio/gnu_java_nio_VMSelector.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by glavaux, Sun Apr 3 16:46:13 2005 UTC revision 1.8 by glavaux, Mon Apr 4 11:04:56 2005 UTC
# Line 153  helper_select (JNIEnv * env, jclass thre Line 153  helper_select (JNIEnv * env, jclass thre
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)
# Line 247  Java_gnu_java_nio_VMSelector_select (JNI Line 249  Java_gnu_java_nio_VMSelector_select (JNI
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
# Line 268  Java_gnu_java_nio_VMSelector_select (JNI Line 270  Java_gnu_java_nio_VMSelector_select (JNI
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.

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26