21 messages in org.ruby-lang.ruby-talkRe: C Threads and Ruby
FromSent OnAttachments
Kroeger, Simon (ext)Jun 20, 2006 3:27 am 
Patrick HurleyJun 20, 2006 4:28 am 
Kroeger, Simon (ext)Jun 20, 2006 4:59 am 
Francis CianfroccaJun 20, 2006 5:13 am 
Patrick HurleyJun 20, 2006 9:39 am 
Paul BrannanJun 20, 2006 11:33 am 
Patrick HurleyJun 20, 2006 1:16 pm 
Francis CianfroccaJun 20, 2006 1:17 pm 
Francis CianfroccaJun 20, 2006 1:19 pm 
Simon KrögerJun 20, 2006 2:29 pm 
Joel VanderWerfJun 20, 2006 2:35 pm 
Francis CianfroccaJun 20, 2006 2:39 pm 
Bill KellyJun 20, 2006 2:42 pm 
Simon KrögerJun 20, 2006 2:49 pm 
Francis CianfroccaJun 20, 2006 3:26 pm 
Francis CianfroccaJun 20, 2006 3:34 pm 
Bill KellyJun 20, 2006 4:08 pm 
Francis CianfroccaJun 20, 2006 5:07 pm 
Kroeger, Simon (ext)Jun 21, 2006 2:53 am 
Francis CianfroccaJun 21, 2006 3:15 am 
Paul BrannanJun 22, 2006 8:21 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: C Threads and RubyActions...
From:Paul Brannan (pbra@atdesk.com)
Date:Jun 22, 2006 8:21:53 am
List:org.ruby-lang.ruby-talk

On Wed, Jun 21, 2006 at 05:17:15AM +0900, Patrick Hurley wrote:

against a Win32 API that required the use of threads. Now I am curious about TRAP_BEG/TRAP_END. Is it safe to access rb_XXX methods from inside a TRAP_BEG/TRAP_END block not in the ruby interpreter thread? If so that would make some things much easier.

What goes between TRAP_BEG/TRAP_END should be something that returns in the event of a signal (such as SIGVTALRM, which ruby uses to know when to switch threads). Usually system calls will return an error code and set errno to EINTR. The system call must later be restarted when control returns to the thread.

I don't believe most rb_XXX methods have this behavior, so you won't get the magic thread switching you get with system calls.

Paul