ck_pr_stall3
Busy-wait primitive
Usage
#include <ck_pr.h>
void
ck_pr_stall(void);
Library
Concurrency Kit (libck, -lck)
Overview
The 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.
Examples
#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;
}
Releases
5 releases since Debian 8 (Jessie); the text changed 1 time.