Browse Source

port r14742 from trunk: Use aio_error instead of aio_suspend(tv=0) to prope for AIO termination: at least netbsd does not make progress with aio_suspend(tv=0)

Samuel Thibault 10 years ago
parent
commit
c69bb74c43
1 changed files with 8 additions and 14 deletions
  1. 8 14
      src/core/disk_ops/unistd/disk_unistd_global.c

+ 8 - 14
src/core/disk_ops/unistd/disk_unistd_global.c

@@ -424,25 +424,19 @@ starpu_unistd_global_wait_request(void * async_channel)
 int
 starpu_unistd_global_test_request(void * async_channel)
 {
-        struct timespec time_wait_request;
-        time_wait_request.tv_sec = 0;
-        time_wait_request.tv_nsec = 0;
+        struct aiocb * aiocb = async_channel;
+        int ret;
 
-        const struct aiocb * aiocb = async_channel;
-        int values = -1;
-        int error_disk = EAGAIN;
+        /* Test the answer of the request */
+        ret = aio_error(aiocb);
 
-        /* Wait the answer of the request */
-        values = aio_suspend(&aiocb, 1, &time_wait_request);
-        error_disk = errno;
-        /* request is finished */
-        if (values == 0)
+        if (ret == 0)
+                /* request is finished */
                 return 1;
-        /* values == -1 */
-        if (error_disk == EAGAIN)
+        if (ret == EINPROGRESS || ret == EAGAIN)
                 return 0;
         /* an error occured */
-        STARPU_ABORT();
+        STARPU_ABORT_MSG("aio_error returned %d", errno);
 }
 
 void