rubyjs / mini_racer

Minimal embedded v8
MIT License
594 stars 93 forks source link

context: allow attached external functions to access JS environment #225

Open gi opened 2 years ago

gi commented 2 years ago

When attaching a Ruby function, it is not possible for that function to evaluate any JavaScript: there is a recursive locking error.

It would be nice if the attached function could access the JavaScript environment. Perhaps, the mutex could be released when calling the attached external function?

This does not work:

context = MiniRacer::Context.new
context.attach("f", ->(*args) { context.eval("1") })
context.call("f")
# => deadlock; recursive locking (ThreadError)

Environment: