Changeset 1631825 for perlconfig.c


Ignore:
Timestamp:
Dec 17, 2008, 3:24:26 PM (13 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
  • perlconfig.c

    re0096b7 r1631825  
    517517  LEAVE;
    518518}
     519
     520void owl_perlconfig_perl_timer(owl_timer *t, void *data)
     521{
     522  SV *obj = data;
     523
     524  if(!SvROK(obj)) {
     525    return;
     526  }
     527
     528  dSP;
     529  ENTER;
     530  SAVETMPS;
     531
     532  PUSHMARK(SP);
     533  XPUSHs(obj);
     534  PUTBACK;
     535
     536  call_method("do_callback", G_DISCARD|G_KEEPERR|G_EVAL);
     537
     538  SPAGAIN;
     539
     540  if (SvTRUE(ERRSV)) {
     541    owl_function_error("Error in calback: '%s'", SvPV_nolen(ERRSV));
     542    sv_setsv (ERRSV, &PL_sv_undef);
     543  }
     544
     545  PUTBACK;
     546  FREETMPS;
     547  LEAVE;
     548}
     549
     550void owl_perlconfig_perl_timer_destroy(owl_timer *t)
     551{
     552  if(SvOK((SV*)t->data)) {
     553    SvREFCNT_dec((SV*)t->data);
     554  }
     555}
Note: See TracChangeset for help on using the changeset viewer.