… | |
… | |
116 | { |
116 | { |
117 | struct ev_watcher *w = (struct ev_watcher *)w_; |
117 | struct ev_watcher *w = (struct ev_watcher *)w_; |
118 | |
118 | |
119 | SvREFCNT_dec (w->fh ); w->fh = 0; |
119 | SvREFCNT_dec (w->fh ); w->fh = 0; |
120 | SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; |
120 | SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; |
|
|
121 | SvREFCNT_dec (w->data ); w->data = 0; |
121 | } |
122 | } |
122 | |
123 | |
123 | static SV * |
124 | static SV * |
124 | e_bless (struct ev_watcher *w, HV *stash) |
125 | e_bless (struct ev_watcher *w, HV *stash) |
125 | { |
126 | { |
… | |
… | |
427 | CHECK_REPEAT (interval); |
428 | CHECK_REPEAT (interval); |
428 | CODE: |
429 | CODE: |
429 | { |
430 | { |
430 | struct ev_periodic *w; |
431 | struct ev_periodic *w; |
431 | w = e_new (sizeof (struct ev_periodic), cb); |
432 | w = e_new (sizeof (struct ev_periodic), cb); |
432 | w->fh = SvOK (reschedule_cb) ? newSVsv (reschedule_cb) : 0; |
433 | w->fh = SvTRUE (reschedule_cb) ? newSVsv (reschedule_cb) : 0; |
433 | ev_periodic_set (w, at, interval, w->fh ? e_periodic_cb : 0); |
434 | ev_periodic_set (w, at, interval, w->fh ? e_periodic_cb : 0); |
434 | RETVAL = e_bless ((struct ev_watcher *)w, stash_periodic); |
435 | RETVAL = e_bless ((struct ev_watcher *)w, stash_periodic); |
435 | if (!ix) ev_periodic_start (w); |
436 | if (!ix) ev_periodic_start (w); |
436 | } |
437 | } |
437 | OUTPUT: |
438 | OUTPUT: |
… | |
… | |
499 | { |
500 | { |
500 | RETVAL = newSVsv (w->cb_sv); |
501 | RETVAL = newSVsv (w->cb_sv); |
501 | |
502 | |
502 | if (items > 1) |
503 | if (items > 1) |
503 | sv_setsv (w->cb_sv, new_cb); |
504 | sv_setsv (w->cb_sv, new_cb); |
|
|
505 | } |
|
|
506 | OUTPUT: |
|
|
507 | RETVAL |
|
|
508 | |
|
|
509 | SV *data (struct ev_watcher *w, SV *new_data = 0) |
|
|
510 | CODE: |
|
|
511 | { |
|
|
512 | RETVAL = w->data ? newSVsv (w->data) : &PL_sv_undef; |
504 | } |
513 | } |
505 | OUTPUT: |
514 | OUTPUT: |
506 | RETVAL |
515 | RETVAL |
507 | |
516 | |
508 | void trigger (struct ev_watcher *w, int revents = EV_NONE) |
517 | void trigger (struct ev_watcher *w, int revents = EV_NONE) |