JVCL Help:TJvMTCountingSection.InitCount

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Summary

The initial count for the semaphore.


Pascal

 propertyInitCount: Integer;


Description

Specifies the number threads inside the section when the component is created at runtime. The threads don't actually have to be inside.
Set InitCount to the initial count for the semaphore object. This value must be greater than or equal to zero and less than or equal to MaxCount.
The count of the semaphore is increased by one whenever Enter is called. The count is decreased by calling the Leave method.
A call to Enter will succeed immediately until the count of the semaphore is equal to MaxCount. Then the semaphore is signaled and a call to Enter will be blocked until another thread calls Leave.


Examples

JvMTCountingSection1.MaxCount := 4;
JvMTCountingSection1.InitCount := 0;
JvMTCountingSection1.Enter;
JvMTCountingSection1.Enter;
JvMTCountingSection1.Enter;
JvMTCountingSection1.Enter;
// the following call will block indefinitely
JvMTCountingSection1.Enter;


See Also

TJvMTCountingSection.MaxCount


About

Notes

You can not change InitCount after you called Enter or Leave.


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page