Typedefs | Functions
Critical Section API

Deprecated implementation of a platform-agnostic critical section. More...

Typedefs

typedef void * AtCritSec
 Opaque data type for a critical section.
 

Functions

AI_API AI_DEPRECATED void AiCritSecInit (AtCritSec *cs)
 Initializes a critical section variable. More...
 
AI_API AI_DEPRECATED void AiCritSecInitRecursive (AtCritSec *cs)
 Initializes a recursive critical section variable. More...
 
AI_API AI_DEPRECATED void AiCritSecClose (AtCritSec *cs)
 Releases all resources used by a critical section variable, so it cannot be used again. More...
 
AI_API AI_DEPRECATED void AiCritSecEnter (AtCritSec *cs)
 Enters a critical section. More...
 
AI_API AI_DEPRECATED void AiCritSecLeave (AtCritSec *cs)
 Leaves a critical section. More...
 

Detailed Description

Deprecated implementation of a platform-agnostic critical section.

Use AtMutex instead.

Function Documentation

AI_API void AiCritSecInit ( AtCritSec cs)

Initializes a critical section variable.

A critical section must be initialized before it can be used by any other functions, and should be coupled with a call to AiCritSecClose() when it is no longer needed.

Usage example:

1 AtCritSec mycs;
2 
3 AiCritSecInit(&mycs);
4 
5 AiCritSecEnter(&mycs);
6 //
7 // critical code goes here ...
8 //
9 AiCritSecLeave(&mycs);
10 
11 AiCritSecClose(&mycs);
Parameters
cspointer to an allocated critical section
See also
AiCritSecClose
AI_API void AiCritSecInitRecursive ( AtCritSec cs)

Initializes a recursive critical section variable.

When creating a critical section, you can choose if you want support for re-entrancy or not. If your code might enter a critical section while it is currently inside the same critical section, you need support for recursion. Note that on Windows all critical sections are recursive, but this is not the case with pthreads-based Unix/Linux/OSX systems.

Two separate methods are provided to maintain backwards compatibility. Only the setup of the critical section depends on this property - the other calls work the same regardless of the type.

Parameters
cspointer to an allocated critical section
See also
AiCritSecInit
AI_API void AiCritSecClose ( AtCritSec cs)

Releases all resources used by a critical section variable, so it cannot be used again.

Parameters
cspointer to a critical section
See also
AiCritSecInit
AI_API void AiCritSecEnter ( AtCritSec cs)

Enters a critical section.

This function enforces that no more than one thread is in the critical section at any given time. A code block between calls to AiCritSecEnter() and AiCritSecLeave() is locked and guaranteed not to overlap with itself.

Parameters
cspointer to a critical section
See also
AiCritSecLeave
AI_API void AiCritSecLeave ( AtCritSec cs)

Leaves a critical section.

Parameters
cspointer to a critical section
See also
AiCritSecEnter

© 2020 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com