ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV.xs
(Generate patch)

Comparing EV/EV.xs (file contents):
Revision 1.59 by root, Thu Nov 8 00:44:17 2007 UTC vs.
Revision 1.62 by root, Fri Nov 9 19:33:51 2007 UTC

23# define HAVE_STRUCT_IN6_ADDR 1 23# define HAVE_STRUCT_IN6_ADDR 1
24#endif 24#endif
25#undef HAVE_STRTOK_R 25#undef HAVE_STRTOK_R
26#undef strtok_r 26#undef strtok_r
27#define strtok_r fake_strtok_r 27#define strtok_r fake_strtok_r
28#include "evdns.h"
28#include "evdns.c" 29#include "evdns.c"
29#endif 30#endif
30 31
31#ifndef WIN32 32#ifndef WIN32
32# include <pthread.h> 33# include <pthread.h>
102 103
103 w = (struct ev_watcher *)SvPVX (self); 104 w = (struct ev_watcher *)SvPVX (self);
104 105
105 ev_watcher_init (w, e_cb); 106 ev_watcher_init (w, e_cb);
106 107
108 w->data = 0;
107 w->fh = 0; 109 w->fh = 0;
108 w->cb_sv = newSVsv (cb_sv); 110 w->cb_sv = newSVsv (cb_sv);
109 w->self = self; 111 w->self = self;
110 112
111 return (void *)w; 113 return (void *)w;
116{ 118{
117 struct ev_watcher *w = (struct ev_watcher *)w_; 119 struct ev_watcher *w = (struct ev_watcher *)w_;
118 120
119 SvREFCNT_dec (w->fh ); w->fh = 0; 121 SvREFCNT_dec (w->fh ); w->fh = 0;
120 SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; 122 SvREFCNT_dec (w->cb_sv); w->cb_sv = 0;
123 SvREFCNT_dec (w->data ); w->data = 0;
121} 124}
122 125
123static SV * 126static SV *
124e_bless (struct ev_watcher *w, HV *stash) 127e_bless (struct ev_watcher *w, HV *stash)
125{ 128{
427 CHECK_REPEAT (interval); 430 CHECK_REPEAT (interval);
428 CODE: 431 CODE:
429{ 432{
430 struct ev_periodic *w; 433 struct ev_periodic *w;
431 w = e_new (sizeof (struct ev_periodic), cb); 434 w = e_new (sizeof (struct ev_periodic), cb);
432 w->fh = SvOK (reschedule_cb) ? newSVsv (reschedule_cb) : 0; 435 w->fh = SvTRUE (reschedule_cb) ? newSVsv (reschedule_cb) : 0;
433 ev_periodic_set (w, at, interval, w->fh ? e_periodic_cb : 0); 436 ev_periodic_set (w, at, interval, w->fh ? e_periodic_cb : 0);
434 RETVAL = e_bless ((struct ev_watcher *)w, stash_periodic); 437 RETVAL = e_bless ((struct ev_watcher *)w, stash_periodic);
435 if (!ix) ev_periodic_start (w); 438 if (!ix) ev_periodic_start (w);
436} 439}
437 OUTPUT: 440 OUTPUT:
499{ 502{
500 RETVAL = newSVsv (w->cb_sv); 503 RETVAL = newSVsv (w->cb_sv);
501 504
502 if (items > 1) 505 if (items > 1)
503 sv_setsv (w->cb_sv, new_cb); 506 sv_setsv (w->cb_sv, new_cb);
507}
508 OUTPUT:
509 RETVAL
510
511SV *data (struct ev_watcher *w, SV *new_data = 0)
512 CODE:
513{
514 RETVAL = w->data ? newSVsv (w->data) : &PL_sv_undef;
504} 515}
505 OUTPUT: 516 OUTPUT:
506 RETVAL 517 RETVAL
507 518
508void trigger (struct ev_watcher *w, int revents = EV_NONE) 519void trigger (struct ev_watcher *w, int revents = EV_NONE)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines