Changeset 1631825 for perlglue.xs


Ignore:
Timestamp:
Dec 17, 2008, 3:24:26 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
f36cd97
Parents:
c675b39
Message:
Implement a perl timer class and minimal interface.

I will document this and add a better API (perhaps through an AnyEvent
impl) in later commits.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlglue.xs

    r25cccdc r1631825  
    399399                                      desc,
    400400                                      ival);
     401
     402IV
     403add_timer(after, interval, cb)
     404        int after
     405        int interval
     406        SV *cb
     407        PREINIT:
     408                SV *ref;
     409                owl_timer *t;
     410        CODE:
     411                ref = sv_rvweaken(newSVsv(cb));
     412                t = owl_select_add_timer(after,
     413                                         interval,
     414                                         owl_perlconfig_perl_timer,
     415                                         owl_perlconfig_perl_timer_destroy,
     416                                         ref);
     417        owl_function_debugmsg("Created timer %p", t);
     418        RETVAL = (IV)t;
     419        OUTPUT:
     420                RETVAL
     421
     422void
     423remove_timer(timer)
     424        IV timer
     425        PREINIT:
     426                owl_timer *t;
     427        CODE:
     428                t = (owl_timer*)timer;
     429                owl_function_debugmsg("Freeing timer %p", t);
     430                                owl_select_remove_timer(t);
Note: See TracChangeset for help on using the changeset viewer.