Changeset f21bc36 for perlconfig.c


Ignore:
Timestamp:
Jun 21, 2011, 11:19:09 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
4da7659
Parents:
7df7be2
git-author:
David Benjamin <davidben@mit.edu> (05/24/11 01:10:12)
git-committer:
David Benjamin <davidben@mit.edu> (06/21/11 23:19:09)
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

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