|
|
|
|
CriticalSectionStart (Function) In french: SectionCritiqueDébut Marks the start of a critical section: no other thread will be able to run the code as long as the current thread does not exit from the critical section.
// Use of a named critical section CriticalSectionStart("MySection") // Two threads will not be able to run this code at the same time ... CriticalSectionEnd("MySection")
Syntax
Starting a named critical section on a code section Hide the details
CriticalSectionStart([<Section name>])
<Section name>: Optional character string Identifies the critical section. This parameter is used to identify the protected code sections. If this parameter is not specified, an automatic critical section is implemented. Remark: the automatic critical section and the critical section corresponding to an empty string ("") are different. Remarks Miscellaneous - For more details on critical sections, see Managing the critical sections.
- If a thread is destroyed while it is found in a critical section, the critical section is automatically freed.
- A single thread is allowed in all the sections with the same name.
- If sections use a different name, a thread can run the code of one section while another thread runs the code of another section.
- For more details, see Associating a critical section with a variable.
SemaphoreStart("SemaphoreName")
is equivalent to: CriticalSectionStart("MyCriticalSection")
Indeed, by default, SemaphoreStart creates a semaphore limited to a single thread.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|