action:Semaphore_Lock
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| action:Semaphore_Lock [2016/06/16 05:42] – peternlewis | action:Semaphore_Lock [2022/10/31 01:42] (current) – [Macros Triggered by the User] peternlewis | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | The //Semaphore actions// (Lock, Unlock and Reset) allow you to limit the execution of a sequence | + | ====== Semaphore Actions ====== |
| + | |||
| + | The //Semaphore actions// (Lock, Unlock and Reset) allow you to prevent (a) multiple triggers | ||
| + | |||
| + | ===== Background ===== | ||
| When you trigger a macro, the Keyboard Maestro Engine takes a copy of it and starts executing it. If you trigger another macro before the first one finishes, that will start executing as well - both will be executing more or less simultaneously. | When you trigger a macro, the Keyboard Maestro Engine takes a copy of it and starts executing it. If you trigger another macro before the first one finishes, that will start executing as well - both will be executing more or less simultaneously. | ||
| - | The normal case is that macros just all run simultaneously, | + | ==== Macros Triggered by the User ==== |
| - | Most macros | + | Although it is rare to have multiple |
| - | But there is another class of macros | + | Most macros are triggered |
| - | Occasionally there are cases where multiple macros are running simultaneously (or the same macro is running multiple times) and care needs to be taken that the sequences of actions are not intermixed. | + | ==== Macros Triggered in the Background ==== |
| - | This is a primary purpose | + | But there is another class of macros that operate in the background, most especially time triggered macros. Macros that are triggered independent |
| - | The //Semaphore actions// | + | ===== Preventing Multiple Executions of One or More Macros ===== |
| + | |||
| + | Occasionally there are cases where multiple macros can be triggered, or the same macro triggered again, before the other macros complete. This can sometimes cause a problem, which needs to be prevented. | ||
| + | |||
| + | **The //Semaphore actions// | ||
| + | |||
| + | **In order to prevent simultaneous executions (instances) of one or more macros that have _Semaphore Locks_ with the same _Semaphore Name_, do the following: | ||
| + | |||
| + | * Place a //Semaphore Lock// Action (using the same Semaphore Name) as the first action of each Macro that you wish to prevent executing simultaneously. | ||
| + | * The lock will remain in place, preventing the other macros from executing, until the current macro instance ((" | ||
| + | * When the Semaphore is _unlocked_ the next macro instance in the queue will execute in First In First Out (FIFO) order. | ||
| + | * You can also cause all additional macro instances | ||
| + | |||
| + | |||
| + | |||
| + | Semaphore Lock can be balanced by a Semaphore Unlock, but a Semaphore is implicitly unlocked when the macro that locked it completes. | ||
| + | |||
| + | Semaphore Reset will forcibly unlock a semaphore and should generally not be used except in very unusual circumstances. | ||
| ===== See Also ===== | ===== See Also ===== | ||
| Line 31: | Line 52: | ||
| - [[https:// | - [[https:// | ||
| - | - [[https://www.google.fr/search?q=site: | + | - [[https://forum.keyboardmaestro.com/t/ |
| + | |||
| + | - [[https://forum.keyboardmaestro.com/ | ||
| + | |||
| + | - [[https:// | ||
action/Semaphore_Lock.1466055734.txt.gz · Last modified: by peternlewis
