search for: rb_protect

Displaying 3 results from an estimated 3 matches for "rb_protect".

Did you mean: r_protect
2006 May 02
1
Converting rb_protect + ruby_stop to pure Ruby
Hi, Within process.c, in the fork method, there''s this bit of code: if(rb_block_given_p()){ int status; rb_protect(rb_yield, Qundef, &status); ruby_stop(status); } I translated that as this: if block_given? status = 0 begin yield rescue Exception status = -1 # Any non-zero result is failure end exit(status) end Is there a way to get the actual status? The $? global...
2011 Jan 05
0
Fwd: Review of libguestfs ruby bindings
...pe (strlistv, T_ARRAY); { size_t i, len; struct rb_ary_entry_args args; int exception; len = RARRAY_LEN (strlistv); strlist = guestfs_safe_malloc (g, sizeof (char *) * (len+1)); for (i = 0; i < len; ++i) { args.arr = strlist; args.offset = i; VALUE v = rb_protect(rb_ary_entry_wrap (VALUE)&args, &exception); if (exception) { free(strlist); rb_jump_tag(exception); } strlist[i] = StringValueCStr (v); } strlist[len] = NULL; } I have many examples of this idiom in the ruby-libvirt code; ext/libvirt/domain.c:li...
2006 Dec 07
0
Fwd: win32-service problems with patch
...- // Wait for Thread service main - WaitForSingleObject(hThread, INFINITE); + // from this point onward, stopevent must be triggered! - return self; + // Create the green thread to poll for Service_Ctrl events + rb_thread_create(Ruby_Service_Ctrl, (void *)self); + + result = rb_protect(daemon_mainloop_protect, self, &status); + if (status) { + // service_main raised an exception + daemon_mainloop_ensure(self); + rb_jump_tag(status); + } + // service_main exited cleanly + return daemon_mainloop_ensure(self); } /*