Tag Link | [Thread_Semaphore] | Category | Threads |
---|---|---|---|
Type | Substitution | Source Available | Yes |
Support | Preferred | Version | 6.0 |
Change | Unchanged | Data Source | Any |
Output Type | Thread_Semaphore | Security | Tag |
Implementation | LDML | Sets | Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0 |
Creates a counter that can be used to control concurrent access to a shared resource. The tag accepts a single parameter which is the maximum value that the counter should be allowed to achieve.
A semaphore can be incremented using the [Thread_Semaphore->Increment] tag or decremented using the [Thread_Semaphore->Decrement] tag.
Once a semaphore has reached its limit, any subsequent attempts to increment the semaphore will wait until the semaphore is decremented. If several pages attempt to increment the semaphore simultaneously, any that go over the semaphore limit will have to wait until one of the other pages has decremented the semaphore.
Note: The use of thread tools is entirely voluntary. There is nothing in Lasso that prevents access to the same shared resource, but the diligent use of the thread tools will ensure predictable results.
[Global: 'mySemaphore' = (Thread_Semaphore: 5)]
[$mySemaphore->(Increment: 1)]
...
[$mySemaphore->(Decrement: 1)]
Required Parameters | |
---|---|
Limit | The maximum value of the semaphore counter. |
See the Lasso 8 Language Guide for examples of how to use this tag.