Created
August 29, 2010 23:54
-
-
Save deepfryed/556829 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ruby.h> | |
VALUE blocking_function(void *data) { | |
throw "die die die"; | |
} | |
VALUE run(VALUE self) { | |
try { | |
rb_thread_blocking_region(blocking_function, 0, 0, 0); | |
} | |
catch (const char *e) { | |
printf("caught: %s\n", e); | |
} | |
return Qtrue; | |
} | |
extern "C" { | |
void Init_tbr() { | |
VALUE mTBR = rb_define_module("TBR"); | |
rb_define_module_function(mTBR, "run", RUBY_METHOD_FUNC(run), 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment