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)]
See the Lasso 8 Language Guide for examples of how to use this tag. This tag is documented on page 100.
Tag Link | [Thread_Semaphore] | Category | Thread |
---|---|---|---|
Type | Substitution | Data Source | Any |
Support | Preferred | Version | 6.0 |
Output Type | Thread_Semaphore | Security | Tag |
Implementation | LDML | Sets | Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0 |
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft