• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/06_lib_uloop/06_handle_events

  1 A handle requires at least one IO event. Mode flags alone, such as
  2 ULOOP_ERROR_CB, register nothing with uloop and are rejected.
  3 
  4 -- Testcase --
  5 {%
  6         import * as uloop from 'uloop';
  7         import * as fs from 'fs';
  8 
  9         uloop.init();
 10 
 11         let fds = fs.pipe();
 12         let base = gc('count');
 13 
 14         for (let flags in [ uloop.ULOOP_ERROR_CB, uloop.ULOOP_EDGE_TRIGGER ]) {
 15                 let handle = uloop.handle(fds[0], () => null, flags);
 16 
 17                 printf("flags %d: %s, %s\n", flags, type(handle), uloop.error());
 18         }
 19 
 20         let handle = uloop.handle(fds[0], () => null,
 21                 uloop.ULOOP_READ | uloop.ULOOP_ERROR_CB);
 22 
 23         printf("read: %s\n", type(handle));
 24         handle.delete();
 25         handle = null;
 26 
 27         printf("alive: %d\n", gc('count') - base);
 28 
 29         uloop.done();
 30 %}
 31 -- End --
 32 
 33 -- Expect stdout --
 34 flags 64: (null), Invalid argument
 35 flags 4: (null), Invalid argument
 36 read: resource
 37 alive: 0
 38 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt