In atomicint§

See primary documentation in context for prefix βš›

multi sub prefix:<βš›>(atomicint $ is rw)

Performs an atomic read of a native integer, which may live in a lexical, attribute, or native array element. Using this operator instead of simply using the variable ensures that the latest update to the variable from other threads will be seen, both by doing any required hardware barriers and also preventing the compiler from lifting reads. For example:

my atomicint $i = 0;
start { $i βš›= 1 }
while βš›$i == 0 { }

Is certain to terminate, while in:

my atomicint $i = 0;
start { $i βš›= 1 }
while $i == 0 { }

It would be legal for a compiler to observe that $i is not updated in the loop, and so lift the read out of the loop, thus causing the program to never terminate.

In Scalar§

See primary documentation in context for prefix βš›

multi sub prefix:<βš›>($target is rw)

Performs an atomic read of the value in the Scalar $target and returns the read value. Using this operator instead of simply using the variable ensures that the latest update to the variable from other threads will be seen, both by doing any required hardware barriers and also preventing the compiler from lifting reads. For example:

my $started = False;
start { $started βš›= True }
until βš›$started { }

Is certain to terminate, while in:

my $started = False;
start { $started βš›= True }
until $started { }

It would be legal for a compiler to observe that $started is not updated in the loop, and so lift the read out of the loop, thus causing the program to never terminate.