Skip to content

Running mutiple COScript and using background threads, anyway serialise them #59

@UXDart

Description

@UXDart

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); and coscript.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:

  • thread A works
  • when thread B starts, 'B' takes all work and A stops/waits
  • when C starts and B waits and C starts and finish
  • then B continue and finish
  • then A finish

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions