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

Sources/ucode/tests/custom/06_lib_uloop/04_task_release

  1 A finished task closes its pipes whether or not it has an input callback,
  2 so that no descriptor is left open after the task completed.
  3 
  4 -- Testcase --
  5 {%
  6         import * as uloop from 'uloop';
  7         import * as fs from 'fs';
  8 
  9         uloop.init();
 10 
 11         let outputs = [];
 12         let base = length(fs.lsdir('/dev/fd'));
 13 
 14         uloop.task((pipe) => 'output only', (msg) => push(outputs, msg));
 15         uloop.task((pipe) => 'no callbacks');
 16         uloop.task((pipe) => pipe.receive(), (msg) => push(outputs, msg), () => 'input');
 17 
 18         uloop.timer(500, () => uloop.end());
 19         uloop.run();
 20 
 21         printf("%s\nopen: %d\n", join('\n', sort(outputs)),
 22                 length(fs.lsdir('/dev/fd')) - base);
 23 
 24         uloop.done();
 25 %}
 26 -- End --
 27 
 28 -- Expect stdout --
 29 input
 30 output only
 31 open: 0
 32 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt