rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 191 forks source link

Release ruby gvl before acquiring v8 lock #356

Closed cowboyd closed 8 months ago

cowboyd commented 9 years ago

Right now, no other thread can be in ruby while javascript is executing because both the V8 lock and the Ruby locks are held. We want to release the ruby gvl before acquiring the v8 lock, In the event that javascript code calls out to Ruby, we want to release the v8 lock and then acquire the gvl.

thedrow commented 8 years ago

I might look into this in the near future. Is there any work done in that regard?

thedrow commented 8 years ago

Also, what happens if two Ruby threads try to run Javascript? Will they compete over the JS lock and one of them will wait until the other completes? Are there known race conditions here that we need to handle?

cowboyd commented 8 years ago

@thedrow Yes, there has been a lot of work toward that end, but unfortunately, I have not be able to complete it.

https://github.com/cowboyd/therubyracer/tree/upgrade-to-v8-4.5