Documentation for method protect

Documentation for method protect, assembled from the following types:

class Lock

From Lock

(Lock) method protect

Defined as:

method protect(Lock:D: &code)

Runs &code and makes sure it is only run in one thread at once.

my $l = Lock.new;
$l.protect({ #`( some unsafe operations here ) 1 + 1});