Skip to content

Instantly share code, notes, and snippets.

@thomaslee
Created January 23, 2013 06:51
Show Gist options
  • Save thomaslee/4602689 to your computer and use it in GitHub Desktop.
Save thomaslee/4602689 to your computer and use it in GitHub Desktop.
use os;
task_b some_func {
os.sleep(5); # give task_a time to die.
some_func();
}
task_a {
#
# Compile some_module.chimp, return a module object.
#
# Note this module object is owned by the GC associated with
# the task backing task_a.
#
var mod = compile("some_module.chimp");
spawn task_b(mod.some_method);
}
main argv {
spawn task_a();
#
# task_b will wake up ~5 seconds in & try to call
# some_func, which has probably been collected.
#
os.sleep(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment