Sublime Forum

How to synchronize multiple calls to run_command()?

#1

Hello :slightly_smiling:

Is there any way to synchronize commands run witch run_command()?

I have 3 run_command() calls:

  1. run_command(‘command1’)
  2. run_command(‘command2’)
  3. run_command(‘command3’)

Command 2 should wait for command 1, command 3 should wait for command 2. What can I do to mate sure that they will be run in right order?

Thanks :slightly_smiling:

0 Likes

#2

See my reply in API Suggestions Discussion: locks for run_command.

Basically, commands are always run synchronously. If a plugin implements it asynchronously (i.e. by starting a thread and deferring actions there), it is most likely intended because the action takes a longer period of time. It is the plugin’s job to provide means of synchronization then, if needed.

2 Likes