InitializeCriticalSection
InitializeCriticalSection initializes a critical section object.
Syntax
VOID InitializeCriticalSection(
[out] LPCRITICAL_SECTION lpCriticalSection
);
Parameters
[out] lpCriticalSection
A pointer to the critical section object.
Return Value
This function does not return a value.
Remarks
A critical section object can be used for mutual-exclusion synchronization by the threads of a single process. The process allocates the memory used by a critical section object, which it can do by declaring a variable of type CRITICAL_SECTION. Before using a critical section, some process thread must call InitializeCriticalSection to initialize the object.
Once a critical-section object has been initialized, the process threads can specify the object in EnterCriticalSection or LeaveCriticalSection to provide mutually exclusive access to a shared resource. A mutex object can be used for similar synchronization between the threads of different processes.
A critical-section object cannot be moved or copied. The process must also not modify the object but must treat it as logically opaque.
Requirements
| Minimum supported version | Header | Library |
|---|---|---|
|
wRTOS 1.0 SDK |
windows.h |
wRTOS_rtss.lib |
See Also: