summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eio.c4
-rw-r--r--eio.h16
-rw-r--r--eio.pod2
3 files changed, 13 insertions, 9 deletions
diff --git a/eio.c b/eio.c
index 58a8c84..249ecea 100644
--- a/eio.c
+++ b/eio.c
@@ -591,9 +591,7 @@ etp_poll (void)
static void
etp_cancel (ETP_REQ *req)
{
- X_LOCK (wrklock);
- req->flags |= EIO_FLAG_CANCELLED;
- X_UNLOCK (wrklock);
+ req->cancelled = 1;
eio_grp_cancel (req);
}
diff --git a/eio.h b/eio.h
index 2f8f029..bfa110d 100644
--- a/eio.h
+++ b/eio.h
@@ -45,6 +45,7 @@ extern "C" {
#endif
#include <stddef.h>
+#include <signal.h>
#include <sys/types.h>
typedef struct eio_req eio_req;
@@ -195,6 +196,12 @@ struct eio_req
long int3; /* chown, fchown: gid */
int errorno; /* errno value on syscall return */
+#if __i386 || __amd64
+ unsigned char cancelled;
+#else
+ sig_atomic_t cancelled;
+#endif
+
unsigned char flags; /* private */
signed char pri; /* the priority */
@@ -210,10 +217,9 @@ struct eio_req
/* _private_ request flags */
enum {
- EIO_FLAG_CANCELLED = 0x01, /* request was cancelled */
- EIO_FLAG_PTR1_FREE = 0x02, /* need to free(ptr1) */
- EIO_FLAG_PTR2_FREE = 0x04, /* need to free(ptr2) */
- EIO_FLAG_GROUPADD = 0x08 /* some request was added to the group */
+ EIO_FLAG_PTR1_FREE = 0x01, /* need to free(ptr1) */
+ EIO_FLAG_PTR2_FREE = 0x02, /* need to free(ptr2) */
+ EIO_FLAG_GROUPADD = 0x04 /* some request was added to the group */
};
/* undocumented/unsupported/private helper */
@@ -308,7 +314,7 @@ void eio_grp_cancel (eio_req *grp); /* cancels all sub requests but not the g
/* request api */
/* true if the request was cancelled, useful in the invoke callback */
-#define EIO_CANCELLED(req) ((req)->flags & EIO_FLAG_CANCELLED)
+#define EIO_CANCELLED(req) ((req)->cancelled)
#define EIO_RESULT(req) ((req)->result)
/* returns a pointer to the result buffer allocated by eio */
diff --git a/eio.pod b/eio.pod
index 04e3f43..f97b5ff 100644
--- a/eio.pod
+++ b/eio.pod
@@ -278,7 +278,7 @@ C<eio_cancel>:
=item eio_cancel (eio_req *req)
-Cancel the request (and all it's subrequests). If the request is currently
+Cancel the request (and all its subrequests). If the request is currently
executing it might still continue to execute, and in other cases it might
still take a while till the request is cancelled.