ck_pr_stall(3) 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;
}