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 [2019/08/25 00:43] – [Preventing Multiple Executions of One or More Macros] JMichaelTX | action:Semaphore_Lock [2022/10/31 01:42] (current) – [Macros Triggered by the User] peternlewis | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Semaphore Actions ====== | ====== Semaphore Actions ====== | ||
| - | The //Semaphore actions// (Lock, Unlock and Reset) allow you prevent (a) multiple triggers of the same macro from executing simultaneously, | + | The //Semaphore actions// (Lock, Unlock and Reset) allow you to prevent (a) multiple triggers of the same macro from executing simultaneously, |
| ===== Background ===== | ===== Background ===== | ||
| Line 9: | Line 9: | ||
| ==== Macros Triggered by the User ==== | ==== Macros Triggered by the User ==== | ||
| + | Although it is rare to have multiple macros triggered at the same time, the normal behaviour in Keyboard Maestro is that all triggered macros run simultaneously, | ||
| - | The normal case is that all triggered macros run simultaneously (or synchronously), | + | Most macros are triggered explicitly |
| - | + | ||
| - | Most macros are triggered explicitly | + | |
| ==== Macros Triggered in the Background ==== | ==== Macros Triggered in the Background ==== | ||
| Line 22: | Line 21: | ||
| 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. | 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 primary purpose of using a // | + | **The // |
| - | In order to achieve this: | + | |
| + | **In order to prevent simultaneous executions | ||
| * Place a //Semaphore Lock// Action (using the same Semaphore Name) as the first action of each Macro that you wish to prevent executing simultaneously. | * 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 lock will remain in place, preventing |
| - | * You can also cause all additional macro instances to be immediately cancelled by setting a very short timeout (1 hundredth of a second) for the Semaphore Action. | + | * 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 | ||
| - | The //Semaphore actions// take a name, and different names can be used for different (independent) locks. | ||
| Semaphore Lock can be balanced by a Semaphore Unlock, but a Semaphore is implicitly unlocked when the macro that locked it completes. | Semaphore Lock can be balanced by a Semaphore Unlock, but a Semaphore is implicitly unlocked when the macro that locked it completes. | ||
action/Semaphore_Lock.1566693802.txt.gz · Last modified: by JMichaelTX
