---
name: "Atomic.h"
section: "3"
platform: "linux"
package: "libzycore-doc"
version: "1.5.2-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Atomic.h"
---

# Atomic.h(3)

## NAME

include/Zycore/Atomic.h

## SYNOPSIS

`#include <Zycore/Defines.h>`\
 `#include <Zycore/Types.h>`\

### Classes

struct **ZyanAtomic32\_**\
 struct **ZyanAtomic64\_**\
 struct **ZyanAtomicPointer\_**\

### Macros

\#define **ZYAN\_ATOMIC\_COMPARE\_EXCHANGE**(destination,  comparand,  value)       ZyanAtomicCompareExchange((**ZyanAtomicPointer**\*)&(destination), (comparand), (value))\
 \#define **ZYAN\_ATOMIC\_INCREMENT**(destination)       ZyanAtomicIncrement((**ZyanAtomicPointer**\*)&(destination));\
 \#define **ZYAN\_ATOMIC\_DECREMENT**(destination)       ZyanAtomicDecrement((**ZyanAtomicPointer**\*)&(destination));\
 \#define **ZYAN\_ATOMIC\_COMPARE\_EXCHANGE32**(destination,  comparand,  value)       ZyanAtomicCompareExchange32((**ZyanAtomic32**\*)&(destination), (comparand), (value))\
 \#define **ZYAN\_ATOMIC\_INCREMENT32**(destination)       ZyanAtomicIncrement32((**ZyanAtomic32**\*)&(destination));\
 \#define **ZYAN\_ATOMIC\_DECREMENT32**(destination)       ZyanAtomicDecrement32((**ZyanAtomic32**\*)&(destination));\
 \#define **ZYAN\_ATOMIC\_COMPARE\_EXCHANGE64**(destination,  comparand,  value)       ZyanAtomicCompareExchange64((**ZyanAtomic64**\*)&(destination), (comparand), (value))\
 \#define **ZYAN\_ATOMIC\_INCREMENT64**(destination)       ZyanAtomicIncrement64((**ZyanAtomic64**\*)&(destination));\
 \#define **ZYAN\_ATOMIC\_DECREMENT64**(destination)       ZyanAtomicDecrement64((**ZyanAtomic64**\*)&(destination));\

### Typedefs

typedef struct **ZyanAtomic32\_** **ZyanAtomic32**\
 typedef struct **ZyanAtomic64\_** **ZyanAtomic64**\
 typedef struct **ZyanAtomicPointer\_** **ZyanAtomicPointer**\

## Detailed Description

Cross compiler atomic intrinsics.

## Macro Definition Documentation

### #define ZYAN\_ATOMIC\_COMPARE\_EXCHANGE(destination, comparand, value) ZyanAtomicCompareExchange((ZyanAtomicPointer\*)&(destination), (comparand), (value))

Compares two values for equality and, if they are equal, replaces the first value.

**Parameters**

*destination* A pointer to the destination value. \
 *comparand* The value to compare with. \
 *value* The replacement value.

**Returns**

The original value.

### #define ZYAN\_ATOMIC\_COMPARE\_EXCHANGE32(destination, comparand, value) ZyanAtomicCompareExchange32((ZyanAtomic32\*)&(destination), (comparand), (value))

Compares two values for equality and, if they are equal, replaces the first value.

**Parameters**

*destination* A pointer to the destination value. \
 *comparand* The value to compare with. \
 *value* The replacement value.

**Returns**

The original value.

### #define ZYAN\_ATOMIC\_COMPARE\_EXCHANGE64(destination, comparand, value) ZyanAtomicCompareExchange64((ZyanAtomic64\*)&(destination), (comparand), (value))

Compares two values for equality and, if they are equal, replaces the first value.

**Parameters**

*destination* A pointer to the destination value. \
 *comparand* The value to compare with. \
 *value* The replacement value.

**Returns**

The original value.

### #define ZYAN\_ATOMIC\_DECREMENT(destination) ZyanAtomicDecrement((ZyanAtomicPointer\*)&(destination));

Decrements the given value and stores the result, as an atomic operation.

**Parameters**

*destination* A pointer to the destination value.

**Returns**

The decremented value.

### #define ZYAN\_ATOMIC\_DECREMENT32(destination) ZyanAtomicDecrement32((ZyanAtomic32\*)&(destination));

Decrements the given value and stores the result, as an atomic operation.

**Parameters**

*destination* A pointer to the destination value.

**Returns**

The decremented value.

### #define ZYAN\_ATOMIC\_DECREMENT64(destination) ZyanAtomicDecrement64((ZyanAtomic64\*)&(destination));

Decrements the given value and stores the result, as an atomic operation.

**Parameters**

*destination* A pointer to the destination value.

**Returns**

The decremented value.

### #define ZYAN\_ATOMIC\_INCREMENT(destination) ZyanAtomicIncrement((ZyanAtomicPointer\*)&(destination));

Increments the given value and stores the result, as an atomic operation.

**Parameters**

*destination* A pointer to the destination value.

**Returns**

The incremented value.

### #define ZYAN\_ATOMIC\_INCREMENT32(destination) ZyanAtomicIncrement32((ZyanAtomic32\*)&(destination));

Increments the given value and stores the result, as an atomic operation.

**Parameters**

*destination* A pointer to the destination value.

**Returns**

The incremented value.

### #define ZYAN\_ATOMIC\_INCREMENT64(destination) ZyanAtomicIncrement64((ZyanAtomic64\*)&(destination));

Increments the given value and stores the result, as an atomic operation.

**Parameters**

*destination* A pointer to the destination value.

**Returns**

The incremented value.

## Author

Generated automatically by Doxygen for Zycore from the source code.
