Hi!

I'm building an OS kernel on V8 JavaScript engine ( 
https://github.com/runtimejs/runtime ). I use separate V8 isolate for every 
application. And I'd like to implement preemption using 
Isolate::RequestInterrupt().

The problem is that I need to call Isolate::RequestInterrupt() from timer 
IRQ interrupt handler and it often deadlocks here:

(execution.cc)

void StackGuard::RequestInterrupt(InterruptFlag flag) {
  ExecutionAccess access(isolate_);    <------------------------- DEADLOCK
  // Check the chain of PostponeInterruptsScopes for interception.
  if (thread_local_.postpone_interrupts_ &&
      thread_local_.postpone_interrupts_->Intercept(flag)) {
    return;
  }
  ...

because interrupt can occur when ExecutionAccess mutex is locked.

Because of this i'm using this dirty hack  
https://github.com/runtimejs/runtime/commit/f3344daf9b1e3384a76566a7f91ef883444ba220
This way it works fine (returns when mutex is locked).

Question: Is it possible to expose an API something like 
TryExecutionAccessLock() or TryRequestInterrupt() that never blocks? Or is 
it possible to replace interrupt check/request mutex with atomic operations?

Thank you.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to