… | |
… | |
8 | #include "autoconf/config.h" |
8 | #include "autoconf/config.h" |
9 | |
9 | |
10 | #include <pthread.h> |
10 | #include <pthread.h> |
11 | |
11 | |
12 | #include <stddef.h> |
12 | #include <stddef.h> |
|
|
13 | #include <errno.h> |
13 | #include <sys/types.h> |
14 | #include <sys/types.h> |
14 | #include <sys/stat.h> |
15 | #include <sys/stat.h> |
15 | #include <limits.h> |
16 | #include <limits.h> |
16 | #include <unistd.h> |
17 | #include <unistd.h> |
17 | #include <fcntl.h> |
18 | #include <fcntl.h> |
… | |
… | |
782 | |
783 | |
783 | PROTOTYPES: ENABLE |
784 | PROTOTYPES: ENABLE |
784 | |
785 | |
785 | BOOT: |
786 | BOOT: |
786 | { |
787 | { |
|
|
788 | HV *stash = gv_stashpv ("IO::AIO", 1); |
|
|
789 | newCONSTSUB (stash, "EXDEV", newSViv (EXDEV)); |
|
|
790 | newCONSTSUB (stash, "O_RDONLY", newSViv (O_RDONLY)); |
|
|
791 | newCONSTSUB (stash, "O_WRONLY", newSViv (O_WRONLY)); |
|
|
792 | |
787 | create_pipe (); |
793 | create_pipe (); |
788 | pthread_atfork (atfork_prepare, atfork_parent, atfork_child); |
794 | pthread_atfork (atfork_prepare, atfork_parent, atfork_child); |
789 | } |
795 | } |
790 | |
796 | |
791 | void |
797 | void |
… | |
… | |
1026 | req->dataptr = SvPVbyte_nolen (req->data); |
1032 | req->dataptr = SvPVbyte_nolen (req->data); |
1027 | |
1033 | |
1028 | send_req (req); |
1034 | send_req (req); |
1029 | } |
1035 | } |
1030 | |
1036 | |
|
|
1037 | #if 0 |
|
|
1038 | |
|
|
1039 | # undocumented, because it does not cancel active requests |
|
|
1040 | void |
|
|
1041 | cancel_most_requests () |
|
|
1042 | PROTOTYPE: |
|
|
1043 | CODE: |
|
|
1044 | { |
|
|
1045 | aio_req *req; |
|
|
1046 | |
|
|
1047 | pthread_mutex_lock (&reqlock); |
|
|
1048 | for (req = reqs; req; req = req->next) |
|
|
1049 | req->flags |= 1; |
|
|
1050 | pthread_mutex_unlock (&reqlock); |
|
|
1051 | |
|
|
1052 | pthread_mutex_lock (&reslock); |
|
|
1053 | for (req = ress; req; req = req->next) |
|
|
1054 | req->flags |= 1; |
|
|
1055 | pthread_mutex_unlock (&reslock); |
|
|
1056 | } |
|
|
1057 | |
|
|
1058 | #endif |
|
|
1059 | |
1031 | void |
1060 | void |
1032 | flush () |
1061 | flush () |
1033 | PROTOTYPE: |
1062 | PROTOTYPE: |
1034 | CODE: |
1063 | CODE: |
1035 | while (nreqs) |
1064 | while (nreqs) |