-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running mutiple COScript and using background threads, anyway serialise them #59
Comments
hmm.. they are sharing the same JSVirtualMachine... so that makes sense then... that must be the reason right? where is COScript creating the JSVirtualMachine? or how can I create a new one for each COScript instance? Thanks |
found a way to create them with different JSVirtualMachine, so each one has its own Mocha instance, and it happens anyway, threads gets serialised... any tip? TIA! |
Are you creating the CocoaScript instances, or is this something that Sketch is handing off to you? |
I tried with Sketch ones, didn't work. so I'm creating the instances myself, so I can do whatever is needed to make it work. atm I find a way to create each instance of Mocha inside COScript using a different JSVirtualMachine, using do you have a sample of how to use the method initWithGlobalContext? what do I need to send exactly so it has a different global context? or what do you think may be the cause of the serialising of the threads? Thanks! |
I'm doing this atm: JSContext *contextNew = [[JSContext alloc] initWithVirtualMachine:[[JSVirtualMachine alloc] init]]; but that seems to work, but then the setvalue getvalue doesn't work... |
I'm not sure what would be causing it off the top of my head. You might ping the sketch folks. |
…mod-heads-in-release Code Review: Fix submod heads in release/55 (24371)
Hello! I'm writing a plugin for Sketch, and inside the cocoa script I use
performSelectorInBackground_withObject
to start a new thread and don't block the execution of a log running process. that works perfect!I call
coscript.setShouldKeepAround(true);
andcoscript.setShouldKeepAround(false);
when the thread ends. that works ok.the problem is that, if I start (lets say) 3 scripts, different names, different COScript instances, this happens:
so for some reason it seems something is making them stop/wait when other thread is working.
I know COScript does not really support threads, but they work... in some way... the question is, why this could be happening? I tried many things, but in all cases this happens. if someone has any tip I can work over that, but I just don't know what else to try... thx!
TIA!
The text was updated successfully, but these errors were encountered: