User Tools

Site Tools


action:Semaphore_Lock

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
action:Semaphore_Lock [2019/08/24 20:43]
JMichaelTX [Preventing Multiple Executions of One or More Macros]
action:Semaphore_Lock [2019/08/25 20:43]
JMichaelTX Rev #2
Line 22: Line 22:
 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 //​Semaphore ​Lock// is to prevent simultaneous ​macro executions of the same, or related, macros.**\\ +**The //​Semaphore ​actions// require a _Semaphore Name_, which uniquely identify each _Semaphore Lock_.** ​ Use a different _Semaphore Name_ to identify different (independent) _Semaphore Locks_. 
-In order to achieve this:+ 
 +**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.   * 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 ​any other macros ​that try to execute ​until the first macro completesor until you execute ​a Semaphore Unlock action. +  * The lock will remain in placepreventing ​the other macros ​from executing, ​until the current ​macro instance (("​macro instances"​ refers to both additional instances of the same macro _and_ instances of other macros that use the same named Semaphore Lock Action.)) ​completes or until the semaphore is unlocked with a Semaphore Unlock action
-  * 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. ​ Since the first Action is a _Semaphore Lock_, only one macro instance is executed at a time
 +  * 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 ​Lock Action. ​ When the Semaphore Local Action times out, it cancels the pending execution of that macro instance. 
  
-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.txt · Last modified: 2022/10/30 21:42 by peternlewis