[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Interpreter Locks



I've run into a pretty serious problem and I'm wondering if anyone has a solution. Essentially I want to call Supercollider using runInterpreter() even though gLangMutex is locked. This comes up in my bridge (see my previous post if you don't what I'm talking about) when an Objective-C method is called from Supercollider which then tries to send a message to an Objective-C subclass in Supercollider. Here is what happens:

1- Some code which calls Objective-C is executed in the interpreter (i.e. window.display where window is an NSWindow). [MyDocument executeSelection:] is called which calls interpretPrintCmdLine in SC. To call interpretPrintCmdLine a lock is taken out. 2- Eventually the Objective-C method is called which then sends a message to a proxy object representing a Supercollider class. 3- The proxy object receives the message and tries to forward it along to SC, but gLangMutex is locked so it deadlocks.

Is it possible to create a copy of the current state of the VM (stack, thread contexts, etc.), call runInterpreter() and then restore the VM to the saved state?

Ryan