ck_pr_cas - Man Page

atomic compare-and-swap operations

Library

Concurrency Kit (libck, -lck)

Synopsis

#include <ck_pr.h>

bool
ck_pr_cas_ptr(void *target, void *old_value, void *new_value);

bool
ck_pr_cas_ptr_value(void *target, void *old_value, void *new_value, void *original_value);

bool
ck_pr_cas_ptr_2(void *target, void *old_value, void *new_value);

bool
ck_pr_cas_ptr_2_value(void *target, void *old_value, void *new_value, void *original_value);

bool
ck_pr_cas_double(double *target, double old_value, double new_value);

bool
ck_pr_cas_double_value(double *target, double old_value, double new_value, double *original_value);

bool
ck_pr_cas_char(char *target, char old_value, char new_value);

bool
ck_pr_cas_char_value(char *target, char old_value, char new_value, char *original_value);

bool
ck_pr_cas_uint(unsigned int *target, unsigned int old_value, unsigned int new_value);

bool
ck_pr_cas_uint_value(unsigned int *target, unsigned int old_value, unsigned int new_value, unsigned int *original_value);

bool
ck_pr_cas_int(int *target, int old_value, int new_value);

bool
ck_pr_cas_int_value(int *target, int old_value, int new_value, int *original_value);

bool
ck_pr_cas_64_2(uint64_t target[static 2], uint64_t old_value[static 2], uint64_t new_value[static 2]);

bool
ck_pr_cas_64_2_value(uint64_t target[static 2], uint64_t old_value[static 2], uint64_t new_value[static 2], uint64_t original_value[static 2]);

bool
ck_pr_cas_64(uint64_t *target, uint64_t old_value, uint64_t new_value);

bool
ck_pr_cas_64_value(uint64_t *target, uint64_t old_value, uint64_t new_value, uint64_t *original_value);

bool
ck_pr_cas_32(uint32_t *target, uint32_t old_value, uint32_t new_value);

bool
ck_pr_cas_32_value(uint32_t *target, uint32_t old_value, uint32_t new_value, uint32_t *original_value);

bool
ck_pr_cas_16(uint16_t *target, uint16_t old_value, uint16_t new_value);

bool
ck_pr_cas_16_value(uint16_t *target, uint16_t old_value, uint16_t new_value, uint16_t *original_value);

bool
ck_pr_cas_8(uint8_t *target, uint8_t old_value, uint8_t new_value);

bool
ck_pr_cas_8_value(uint8_t *target, uint8_t old_value, uint8_t new_value, uint8_t *original_value);

Description

The ck_pr_cas(3) family of functions atomically compare the value in target for equality with old_value and if so, replace the value pointed to by target with the value specified by new_value. If the value in target was not equal to the value specified by old_value then no modifications occur to the value in target. The *_value form of these functions unconditionally update original_value.

Return Values

This family of functions return true if the value in target was modified as a result of the operation. Otherwise, they return false.

See Also

ck_pr_fence_load(3), ck_pr_fence_load_depends(3), ck_pr_fence_store(3), ck_pr_fence_memory(3), ck_pr_load(3), ck_pr_store(3), ck_pr_fas(3), ck_pr_faa(3), ck_pr_inc(3), ck_pr_dec(3), ck_pr_neg(3), ck_pr_not(3), ck_pr_sub(3), ck_pr_and(3), ck_pr_or(3), ck_pr_xor(3), ck_pr_add(3), ck_pr_btc(3), ck_pr_bts(3), ck_pr_btr(3)

Additional information available at http://concurrencykit.org/

Referenced By

ck_pr(3), ck_pr_add(3), ck_pr_and(3), ck_pr_barrier(3), ck_pr_btc(3), ck_pr_btr(3), ck_pr_bts(3), ck_pr_dec(3), ck_pr_faa(3), ck_pr_fas(3), ck_pr_fence_acquire(3), ck_pr_fence_atomic(3), ck_pr_fence_atomic_load(3), ck_pr_fence_atomic_store(3), ck_pr_fence_load(3), ck_pr_fence_load_atomic(3), ck_pr_fence_load_depends(3), ck_pr_fence_load_store(3), ck_pr_fence_memory(3), ck_pr_fence_release(3), ck_pr_fence_store(3), ck_pr_fence_store_atomic(3), ck_pr_fence_store_load(3), ck_pr_inc(3), ck_pr_load(3), ck_pr_neg(3), ck_pr_not(3), ck_pr_or(3), ck_pr_stall(3), ck_pr_store(3), ck_pr_sub(3), ck_pr_xor(3).

April 11, 2013