… | |
… | |
869 | C_ARGS: e_loop (w), w |
869 | C_ARGS: e_loop (w), w |
870 | |
870 | |
871 | void ev_feed_event (ev_watcher *w, int revents = EV_NONE) |
871 | void ev_feed_event (ev_watcher *w, int revents = EV_NONE) |
872 | C_ARGS: e_loop (w), w, revents |
872 | C_ARGS: e_loop (w), w, revents |
873 | |
873 | |
874 | int keepalive (ev_watcher *w, int new_value = 0) |
874 | int keepalive (ev_watcher *w, SV *new_value = NO_INIT) |
875 | CODE: |
875 | CODE: |
876 | { |
876 | { |
877 | RETVAL = w->e_flags & WFLAG_KEEPALIVE; |
877 | RETVAL = w->e_flags & WFLAG_KEEPALIVE; |
878 | new_value = new_value ? WFLAG_KEEPALIVE : 0; |
|
|
879 | |
878 | |
880 | if (items > 1 && ((new_value ^ w->e_flags) & WFLAG_KEEPALIVE)) |
879 | if (items > 1) |
881 | { |
880 | { |
|
|
881 | int value = SvTRUE (new_value) ? WFLAG_KEEPALIVE : 0; |
|
|
882 | |
|
|
883 | if ((value ^ w->e_flags) & WFLAG_KEEPALIVE) |
|
|
884 | { |
882 | w->e_flags = (w->e_flags & ~WFLAG_KEEPALIVE) | new_value; |
885 | w->e_flags = (w->e_flags & ~WFLAG_KEEPALIVE) | value; |
883 | REF (w); |
886 | REF (w); |
884 | UNREF (w); |
887 | UNREF (w); |
|
|
888 | } |
885 | } |
889 | } |
886 | } |
890 | } |
887 | OUTPUT: |
891 | OUTPUT: |
888 | RETVAL |
892 | RETVAL |
889 | |
893 | |
890 | SV *cb (ev_watcher *w, SV *new_cb = 0) |
894 | SV *cb (ev_watcher *w, SV *new_cb = NO_INIT) |
891 | CODE: |
895 | CODE: |
892 | { |
896 | { |
893 | if (items > 1) |
897 | if (items > 1) |
894 | { |
898 | { |
895 | new_cb = s_get_cv_croak (new_cb); |
899 | new_cb = s_get_cv_croak (new_cb); |
… | |
… | |
900 | RETVAL = newRV_inc (w->cb_sv); |
904 | RETVAL = newRV_inc (w->cb_sv); |
901 | } |
905 | } |
902 | OUTPUT: |
906 | OUTPUT: |
903 | RETVAL |
907 | RETVAL |
904 | |
908 | |
905 | SV *data (ev_watcher *w, SV *new_data = 0) |
909 | SV *data (ev_watcher *w, SV *new_data = NO_INIT) |
906 | CODE: |
910 | CODE: |
907 | { |
911 | { |
908 | RETVAL = w->data ? newSVsv (w->data) : &PL_sv_undef; |
912 | RETVAL = w->data ? newSVsv (w->data) : &PL_sv_undef; |
909 | |
913 | |
910 | if (items > 1) |
914 | if (items > 1) |
… | |
… | |
920 | CODE: |
924 | CODE: |
921 | RETVAL = newRV_inc (w->loop); |
925 | RETVAL = newRV_inc (w->loop); |
922 | OUTPUT: |
926 | OUTPUT: |
923 | RETVAL |
927 | RETVAL |
924 | |
928 | |
925 | int priority (ev_watcher *w, int new_priority = 0) |
929 | int priority (ev_watcher *w, SV *new_priority = NO_INIT) |
926 | CODE: |
930 | CODE: |
927 | { |
931 | { |
928 | RETVAL = w->priority; |
932 | RETVAL = w->priority; |
929 | |
933 | |
930 | if (items > 1) |
934 | if (items > 1) |
… | |
… | |
938 | XPUSHs (ST (0)); |
942 | XPUSHs (ST (0)); |
939 | PUTBACK; |
943 | PUTBACK; |
940 | call_method ("stop", G_DISCARD | G_VOID); |
944 | call_method ("stop", G_DISCARD | G_VOID); |
941 | } |
945 | } |
942 | |
946 | |
943 | ev_set_priority (w, new_priority); |
947 | ev_set_priority (w, SvIV (new_priority)); |
944 | |
948 | |
945 | if (active) |
949 | if (active) |
946 | { |
950 | { |
947 | PUSHMARK (SP); |
951 | PUSHMARK (SP); |
948 | XPUSHs (ST (0)); |
952 | XPUSHs (ST (0)); |
… | |
… | |
977 | |
981 | |
978 | sv_setsv (e_fh (w), fh); |
982 | sv_setsv (e_fh (w), fh); |
979 | RESET (io, w, (w, fd, events)); |
983 | RESET (io, w, (w, fd, events)); |
980 | } |
984 | } |
981 | |
985 | |
982 | SV *fh (ev_io *w, SV *new_fh = 0) |
986 | SV *fh (ev_io *w, SV *new_fh = NO_INIT) |
983 | CODE: |
987 | CODE: |
984 | { |
988 | { |
985 | if (items > 1) |
989 | if (items > 1) |
986 | { |
990 | { |
987 | int fd = s_fileno (new_fh, w->events & EV_WRITE); |
991 | int fd = s_fileno (new_fh, w->events & EV_WRITE); |
… | |
… | |
996 | RETVAL = newSVsv (e_fh (w)); |
1000 | RETVAL = newSVsv (e_fh (w)); |
997 | } |
1001 | } |
998 | OUTPUT: |
1002 | OUTPUT: |
999 | RETVAL |
1003 | RETVAL |
1000 | |
1004 | |
1001 | int events (ev_io *w, int new_events = EV_UNDEF) |
1005 | int events (ev_io *w, int new_events = NO_INIT) |
1002 | CODE: |
1006 | CODE: |
1003 | { |
1007 | { |
1004 | RETVAL = w->events; |
1008 | RETVAL = w->events; |
1005 | |
1009 | |
1006 | if (items > 1 && (new_events ^ w->events) & (EV_READ | EV_WRITE)) |
1010 | if (items > 1 && (new_events ^ w->events) & (EV_READ | EV_WRITE)) |
… | |
… | |
1035 | CHECK_SIG (signal, signum); |
1039 | CHECK_SIG (signal, signum); |
1036 | |
1040 | |
1037 | RESET_SIGNAL (w, (w, signum)); |
1041 | RESET_SIGNAL (w, (w, signum)); |
1038 | } |
1042 | } |
1039 | |
1043 | |
1040 | int signal (ev_signal *w, SV *new_signal = 0) |
1044 | int signal (ev_signal *w, SV *new_signal = NO_INIT) |
1041 | CODE: |
1045 | CODE: |
1042 | { |
1046 | { |
1043 | RETVAL = w->signum; |
1047 | RETVAL = w->signum; |
1044 | |
1048 | |
1045 | if (items > 1) |
1049 | if (items > 1) |
1046 | { |
1050 | { |
1047 | Signal signum = s_signum (new_signal); |
1051 | Signal signum = s_signum (new_signal); |
1048 | CHECK_SIG (new_signal, signum); |
1052 | CHECK_SIG (new_signal, signum); |
1049 | |
|
|
1050 | RESET_SIGNAL (w, (w, signum)); |
1053 | RESET_SIGNAL (w, (w, signum)); |
1051 | } |
1054 | } |
1052 | } |
1055 | } |
1053 | OUTPUT: |
1056 | OUTPUT: |
1054 | RETVAL |
1057 | RETVAL |
… | |
… | |
1065 | CODE: |
1068 | CODE: |
1066 | STOP (timer, w); |
1069 | STOP (timer, w); |
1067 | |
1070 | |
1068 | void ev_timer_again (ev_timer *w, NV repeat = NO_INIT) |
1071 | void ev_timer_again (ev_timer *w, NV repeat = NO_INIT) |
1069 | CODE: |
1072 | CODE: |
|
|
1073 | { |
1070 | if (items > 1) |
1074 | if (items > 1) |
|
|
1075 | { |
|
|
1076 | CHECK_REPEAT (repeat); |
1071 | w->repeat = repeat; |
1077 | w->repeat = repeat; |
1072 | CHECK_REPEAT (w->repeat); |
1078 | } |
|
|
1079 | |
1073 | ev_timer_again (e_loop (w), w); |
1080 | ev_timer_again (e_loop (w), w); |
1074 | UNREF (w); |
1081 | UNREF (w); |
|
|
1082 | } |
1075 | |
1083 | |
1076 | NV ev_timer_remaining (ev_timer *w) |
1084 | NV ev_timer_remaining (ev_timer *w) |
1077 | C_ARGS: e_loop (w), w |
1085 | C_ARGS: e_loop (w), w |
1078 | |
1086 | |
1079 | void DESTROY (ev_timer *w) |
1087 | void DESTROY (ev_timer *w) |
… | |
… | |
1085 | INIT: |
1093 | INIT: |
1086 | CHECK_REPEAT (repeat); |
1094 | CHECK_REPEAT (repeat); |
1087 | CODE: |
1095 | CODE: |
1088 | RESET (timer, w, (w, after, repeat)); |
1096 | RESET (timer, w, (w, after, repeat)); |
1089 | |
1097 | |
|
|
1098 | NV repeat (ev_timer *w, SV *new_repeat = NO_INIT) |
|
|
1099 | CODE: |
|
|
1100 | RETVAL = w->repeat; |
|
|
1101 | if (items > 1) |
|
|
1102 | { |
|
|
1103 | NV repeat = SvNV (new_repeat); |
|
|
1104 | CHECK_REPEAT (repeat); |
|
|
1105 | w->repeat = repeat; |
|
|
1106 | } |
|
|
1107 | OUTPUT: |
|
|
1108 | RETVAL |
|
|
1109 | |
1090 | MODULE = EV PACKAGE = EV::Periodic PREFIX = ev_periodic_ |
1110 | MODULE = EV PACKAGE = EV::Periodic PREFIX = ev_periodic_ |
1091 | |
1111 | |
1092 | void ev_periodic_start (ev_periodic *w) |
1112 | void ev_periodic_start (ev_periodic *w) |
1093 | INIT: |
1113 | INIT: |
1094 | CHECK_REPEAT (w->interval); |
1114 | CHECK_REPEAT (w->interval); |
… | |
… | |
1124 | CODE: |
1144 | CODE: |
1125 | RETVAL = ev_periodic_at (w); |
1145 | RETVAL = ev_periodic_at (w); |
1126 | OUTPUT: |
1146 | OUTPUT: |
1127 | RETVAL |
1147 | RETVAL |
1128 | |
1148 | |
|
|
1149 | NV offset (ev_periodic *w, SV *new_offset = NO_INIT) |
|
|
1150 | CODE: |
|
|
1151 | RETVAL = w->offset; |
|
|
1152 | if (items > 1) |
|
|
1153 | w->offset = SvNV (new_offset); |
|
|
1154 | OUTPUT: |
|
|
1155 | RETVAL |
|
|
1156 | |
|
|
1157 | NV interval (ev_periodic *w, SV *new_interval = NO_INIT) |
|
|
1158 | CODE: |
|
|
1159 | RETVAL = w->interval; |
|
|
1160 | if (items > 1) |
|
|
1161 | { |
|
|
1162 | NV interval = SvNV (new_interval); |
|
|
1163 | CHECK_REPEAT (interval); |
|
|
1164 | w->interval = interval; |
|
|
1165 | } |
|
|
1166 | OUTPUT: |
|
|
1167 | RETVAL |
|
|
1168 | |
|
|
1169 | SV *reschedule_cb (ev_periodic *w, SV *new_reschedule_cb = NO_INIT) |
|
|
1170 | CODE: |
|
|
1171 | RETVAL = e_fh (w) ? e_fh (w) : &PL_sv_undef; |
|
|
1172 | if (items > 1) |
|
|
1173 | { |
|
|
1174 | sv_2mortal (RETVAL); |
|
|
1175 | e_fh (w) = SvTRUE (new_reschedule_cb) ? newSVsv (new_reschedule_cb) : 0; |
|
|
1176 | } |
|
|
1177 | OUTPUT: |
|
|
1178 | RETVAL |
|
|
1179 | |
1129 | MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_ |
1180 | MODULE = EV PACKAGE = EV::Idle PREFIX = ev_idle_ |
1130 | |
1181 | |
1131 | void ev_idle_start (ev_idle *w) |
1182 | void ev_idle_start (ev_idle *w) |
1132 | CODE: |
1183 | CODE: |
1133 | START (idle, w); |
1184 | START (idle, w); |
… | |
… | |
1266 | { |
1317 | { |
1267 | sv_setsv (e_fh (w), path); |
1318 | sv_setsv (e_fh (w), path); |
1268 | RESET (stat, w, (w, SvPVbyte_nolen (e_fh (w)), interval)); |
1319 | RESET (stat, w, (w, SvPVbyte_nolen (e_fh (w)), interval)); |
1269 | } |
1320 | } |
1270 | |
1321 | |
1271 | SV *path (ev_stat *w, SV *new_path = 0) |
1322 | SV *path (ev_stat *w, SV *new_path = NO_INIT) |
1272 | CODE: |
1323 | CODE: |
1273 | { |
1324 | { |
1274 | RETVAL = SvREFCNT_inc (e_fh (w)); |
1325 | RETVAL = e_fh (w) ? e_fh (w) : &PL_sv_undef; |
1275 | |
1326 | |
1276 | if (items > 1) |
1327 | if (items > 1) |
1277 | { |
1328 | { |
1278 | SvREFCNT_dec (e_fh (w)); |
1329 | sv_2mortal (RETVAL); |
1279 | e_fh (w) = newSVsv (new_path); |
1330 | e_fh (w) = newSVsv (new_path); |
1280 | RESET (stat, w, (w, SvPVbyte_nolen (e_fh (w)), w->interval)); |
1331 | RESET (stat, w, (w, SvPVbyte_nolen (e_fh (w)), w->interval)); |
1281 | } |
1332 | } |
1282 | } |
1333 | } |
1283 | OUTPUT: |
1334 | OUTPUT: |
1284 | RETVAL |
1335 | RETVAL |
1285 | |
1336 | |
1286 | NV interval (ev_stat *w, NV new_interval = 0.) |
1337 | NV interval (ev_stat *w, SV *new_interval = NO_INIT) |
1287 | CODE: |
1338 | CODE: |
1288 | { |
|
|
1289 | RETVAL = w->interval; |
1339 | RETVAL = w->interval; |
1290 | |
|
|
1291 | if (items > 1) |
1340 | if (items > 1) |
1292 | RESET (stat, w, (w, SvPVbyte_nolen (e_fh (w)), new_interval)); |
1341 | { |
1293 | } |
1342 | PAUSE (stat); |
|
|
1343 | w->interval = SvNV (new_interval); |
|
|
1344 | RESUME (stat); |
|
|
1345 | } |
1294 | OUTPUT: |
1346 | OUTPUT: |
1295 | RETVAL |
1347 | RETVAL |
1296 | |
1348 | |
1297 | void prev (ev_stat *w) |
1349 | void prev (ev_stat *w) |
1298 | ALIAS: |
1350 | ALIAS: |