Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c

What is atomic_load in C ?

Sheza Naveed

Syntax

C atomic_load( volatile A* obj );

The atomic_load function atomically returns the value that the obj is pointing to. The volatile keyword informs the compiler that the value of this variable may change anytime.

This is an atomic operation that uses sequential consistency - memory_order_seq_cst. The memory order is given as an argument to those functions that carry out atomic operations. It states how operations on various threads are synchronized.

Explanation

A - one of the atomic types.

C - A's corresponding non-atomic type.

Parameters

The function takes in one parameter, as stated below:

obj - the pointer to the atomic object that has to be read.

Return value

The value of atomic variable that the object is currently pointing at.

RELATED TAGS

c

CONTRIBUTOR

Sheza Naveed
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring