ck_pr_stall (3) - Linux Manuals

ck_pr_stall: busy-wait primitive

NAME

ck_pr_stall - busy-wait primitive

LIBRARY

Concurrency Kit (libck, -lck)

SYNOPSIS

In ck_pr.h Ft void Fn ck_pr_stall void

DESCRIPTION

The Fn ck_pr_stall 3 function should be used inside retry paths of busy-wait loops. It not only serves as a compiler barrier, but on some architectures it emits cycle-saving instructions.

EXAMPLE

#include <ck_pr.h>

static int ready = 0;

void
function(void)
{

        /* Busy-wait until ready is non-zero. */
        while (ck_pr_load_int(&ready) == 0)
                ck_pr_stall();

        return;
}

SEE ALSO

ck_pr_fence_load3, ck_pr_fence_load_depends3, ck_pr_fence_store3, ck_pr_fence_memory3, ck_pr_barrier3, ck_pr_fas3, ck_pr_load3, ck_pr_store3, ck_pr_faa3, ck_pr_inc3, ck_pr_dec3, ck_pr_neg3, ck_pr_not3, ck_pr_add3, ck_pr_sub3, ck_pr_and3, ck_pr_or3, ck_pr_xor3, ck_pr_cas3, ck_pr_btc3, ck_pr_bts3, ck_pr_btr3

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