… | |
… | |
94 | my \$current = \$Coro::current; |
94 | my \$current = \$Coro::current; |
95 | my \$state; |
95 | my \$state; |
96 | my \@res; |
96 | my \@res; |
97 | |
97 | |
98 | push \@_, sub { |
98 | push \@_, sub { |
99 | \$state = Coro::_aio_get_state; |
99 | \$state = _get_state; |
100 | \@res = \@_; |
100 | \@res = \@_; |
101 | \$current->ready; |
101 | \$current->ready; |
102 | }; |
102 | }; |
103 | |
103 | |
104 | &$iosub; |
104 | &$iosub; |
105 | |
105 | |
106 | Coro::schedule; |
106 | Coro::schedule; |
107 | Coro::schedule while !\$state; |
107 | Coro::schedule while !\$state; |
108 | |
108 | |
109 | Coro::_aio_set_state \$state; |
109 | _set_state \$state; |
110 | wantarray ? \@res : \$res[0] |
110 | wantarray ? \@res : \$res[0] |
111 | } |
111 | } |
112 | }; |
112 | }; |
113 | die if $@; |
113 | die if $@; |
114 | } |
114 | } |