Changeset bcde7926 for perlconfig.c


Ignore:
Timestamp:
Jun 22, 2011, 12:37:21 AM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
bbb7876
Parents:
074bdaa
git-author:
David Benjamin <davidben@mit.edu> (05/24/11 01:10:12)
git-committer:
David Benjamin <davidben@mit.edu> (06/22/11 00:37:21)
Message:
Reimplement BarnOwl::add_io_dispatch with AnyEvent

We can emulate the interesting semantics with perl. The one difference
is that perl code can now register an IO dispatch on file descriptors C
code was interested in. This isn't a big deal was Glib can handle
multiple watches on the same FD. Granted, more than one reader on an FD
would cause trouble, but there was nothing stopping perl code from
reading from an FD we cared about anyway.

AnyEvent also does not support select's exceptfd, so this is a slight
behavior change, but probably an uninteresting one.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlconfig.c

    r074bdaa rbcde7926  
    548548}
    549549
    550 void owl_perlconfig_io_dispatch_destroy(const owl_io_dispatch *d)
    551 {
    552   SvREFCNT_dec(d->data);
    553 }
    554 
    555550void owl_perlconfig_edit_callback(owl_editwin *e)
    556551{
     
    587582  SvREFCNT_dec(v);
    588583}
    589 
    590 void owl_perlconfig_io_dispatch(const owl_io_dispatch *d, void *data)
    591 {
    592   SV *cb = data;
    593   dSP;
    594   if(cb == NULL) {
    595     owl_function_error("Perl callback is NULL!");
    596     return;
    597   }
    598 
    599   ENTER;
    600   SAVETMPS;
    601 
    602   PUSHMARK(SP);
    603   PUTBACK;
    604 
    605   call_sv(cb, G_DISCARD|G_EVAL);
    606 
    607   if(SvTRUE(ERRSV)) {
    608     owl_function_error("%s", SvPV_nolen(ERRSV));
    609   }
    610 
    611   FREETMPS;
    612   LEAVE;
    613 }
Note: See TracChangeset for help on using the changeset viewer.