hsbt_away changed the topic of #ruby-core to: check the latest release candidate for 1.9.1 release ftp.ruby-lang.org:/home/yugui/ruby-1.9.1-r26021+1.tar.bz2
kosaki2 has quit [Read error: Connection reset by peer]
idkazuma has quit [Remote host closed the connection]
idkazuma has joined #ruby-core
idkazuma has quit [Ping timeout: 258 seconds]
<zzak>
charlie lol
<zzak>
i wish he would just ask me :(
<injekt>
:D
<injekt>
zzak: that would make way too much sense
<zzak>
he doesnt need to ask for permission, thats usually what it is
<injekt>
ah
<zzak>
but idk
nagachika has quit [Remote host closed the connection]
nari has joined #ruby-core
ZachBeta has joined #ruby-core
nari_ has joined #ruby-core
nari has quit [Ping timeout: 264 seconds]
nari_ has quit [Ping timeout: 260 seconds]
ZachBeta has quit [Quit: Computer has gone to sleep.]
ZachBeta has joined #ruby-core
judofyr has quit [Remote host closed the connection]
xibbar has quit [Remote host closed the connection]
headius has joined #ruby-core
enebo has joined #ruby-core
enebo has quit [Read error: Connection reset by peer]
enebo has joined #ruby-core
kosaki2 has joined #ruby-core
<znz_jp>
biff: [ruby-changes:28472] nagai:r40524 (trunk): * ext/tk/MANUAL_tcltklib.ja, ext/tk/old-README.tcltklib.ja: rename from *.jp to *.ja - http://mla.n-z.jp/?ruby-changes=28472
shiba has quit [Ping timeout: 252 seconds]
ex9t has joined #ruby-core
ex9t_ has quit [Ping timeout: 252 seconds]
hsbt is now known as hsbt_away
ZachBeta has quit [Quit: Computer has gone to sleep.]
nokada_ has quit [Read error: Connection reset by peer]
nokada has joined #ruby-core
tmahoney has joined #ruby-core
idkazuma has joined #ruby-core
<tmahoney>
Is Ruby safe to run in threads that were created outside of Ruby? My C/C++ application creates its own threads and runs Ruby code in there, but doesn't use Ruby's Threads.
<drbrain>
tmahoney: I think you have to initialize ruby on the thread first
<drbrain>
I'm unsure of how you do that, though
<drbrain>
try looking in include/ruby/thread.h
<drbrain>
_ko1 knows
<drbrain>
… I think ruby needs to know the stack limits for the thread so the GC can see your objects
<tmahoney>
Hmm. By initialize you don't mean ruby_init(), do you?
agarie has joined #ruby-core
<drbrain>
I think you want ruby_init_stack()
hsbt_away is now known as hsbt
<tmahoney>
I'll have multiple threads though. Is that safe to call multiple times?
<tmahoney>
I remember reading something that you can't in 1.8.7, but I'm in 2.0.0 now.
<drbrain>
it looks safe
<drbrain>
how does code get executed in your new threads?
<drbrain>
do you go ruby -> separate C library -> ruby?
<drbrain>
or is your ruby embedded?
<tmahoney>
It's embedded. Are you familiar with web workers?
<drbrain>
vaguely
<drbrain>
I asked to see if your design was a good fit or not
<tmahoney>
A web worker is a module that takes a script (JavaScript, but in this case it's Ruby), and executes that script on a new thread.
* drbrain
nods
<drbrain>
so you want to block your C library until ruby is done
<tmahoney>
Yeah. That's kind of already built in.
<tmahoney>
Hold on, I'll type something out.
<drbrain>
looks like there's a RUBY_INIT_STACK macro in ruby/ruby.h
<tmahoney>
Yeah, I use that when I initialize Ruby on the main thread. You're saying I should use it again?
charliesome has joined #ruby-core
<drbrain>
I think so, as each thread has its own stack
<drbrain>
if you hang around here long enough _ko1 or nokada or someone will tell you if I'm wrong (or not)
<tmahoney>
By the time I get to that function, I'm already in a new thread.
<tmahoney>
So if I call RUBY_INIT_STACK in there, it'll initialize the stack to the new thread. The problem is that there is also Ruby code being executed in other threads.
<tmahoney>
Should I be grabbing the global interpreter lock as well?
<drbrain>
I don't see ruby_init_stack() doing anything that would require the GVL
<tmahoney>
What about the code in the script that's being evaluated?
<drbrain>
but I think you would want to call evaluate() via rb_thread_call_with_gvl() (grab the GVL)
<tmahoney>
Ah okay.
<tmahoney>
Would I have to call ruby_init_stack again after getting back to the main thread?
<drbrain>
I think you only need to call it once per thread
hsbt is now known as hsbt_away
hsbt_away is now known as hsbt
<drbrain>
it says "I am going to store pointers to ruby objects from this point on the stack to the end"
<tmahoney>
Where is it defined? I'm trying to find it, but I can't haha.
<tmahoney>
I see it declared in ruby.h, but can't find the definition.
<drbrain>
there's a RUBY_INIT_STACK macro in ruby/ruby.h
<tmahoney>
Ohhh, the definitions are in the thread_*.c
<tmahoney>
Okay, awesome.
<tmahoney>
Thanks, drbrain. I'll try this out and see if it works.
idkazuma has quit [Remote host closed the connection]
<drbrain>
great!
<drbrain>
I hope I told you correct things :D
<tmahoney>
Haha hopefully.
enebo has quit [Quit: enebo]
hsbt is now known as hsbt_away
kosaki2 has quit [Remote host closed the connection]
kosaki2 has joined #ruby-core
headius has quit [Quit: headius]
xibbar has joined #ruby-core
idkazuma has joined #ruby-core
<tmahoney>
drbrain: I'm getting some problems during garbage collection.
<tmahoney>
I'm in the thread, I init the stack, I evaluate the script, then (to test) I manually call rb_gc().
<tmahoney>
Then I get an exception in mark_locations_array (gc.c) where it calls v = *x;