@@ -45,19 +45,19 @@ so a thread that is waiting to acquire a lock is, from the point of view
45
45
of the operating system, blocked.
46
46
47
47
Code using high-level Raku concurrency constructs should avoid using
48
- C<Lock>. Waiting to acquire a C<Lock> blocks a real C< Thread>, meaning
48
+ C<Lock>. Waiting to acquire a C<Lock> blocks a real L<C<Thread>|/type/ Thread>, meaning
49
49
that the thread pool (used by numerous higher-level Raku concurrency
50
50
mechanisms) cannot use that thread in the meantime for anything else.
51
51
52
52
Any C<await> performed while a C<Lock> is held will behave in a blocking
53
53
manner; the standard non-blocking behavior of C<await> relies on the
54
- code following the `await` resuming on a different C< Thread> from the
54
+ code following the `await` resuming on a different L<C<Thread>|/type/ Thread> from the
55
55
pool, which is incompatible with the requirement that a C<Lock> be
56
56
unlocked by the same thread that locked it. See
57
- L<C<Lock::Async>|/type/Lock/ Async>
57
+ L<C<Lock::Async>|/type/Lock:: Async>
58
58
for an alternative mechanism that does not have this shortcoming. Other than
59
59
that, the main difference is that C<Lock> mainly maps to operating system
60
- mechanisms, while C< Lock::Async> uses Raku primitives to achieve similar
60
+ mechanisms, while L<C<Lock::Async>|/type/ Lock::Async> uses Raku primitives to achieve similar
61
61
effects. If you're doing low-level stuff (native bindings) and/or actually
62
62
want to block real OS threads, use C<Lock>. However, if you want a
63
63
non-blocking mutual exclusion and don't need recursion and are running code
@@ -67,7 +67,7 @@ By their nature, C<Lock>s are not composable, and it is possible to
67
67
end up with hangs should circular dependencies on locks occur. Prefer
68
68
to structure concurrent programs such that they communicate results
69
69
rather than modify shared data structures, using mechanisms like
70
- L<Promise|/type/Promise>, L<Channel|/type/Channel> and L<Supply|/type/Supply>.
70
+ L<C< Promise> |/type/Promise>, L<C< Channel> |/type/Channel> and L<C< Supply> |/type/Supply>.
71
71
72
72
73
73
=head1 Methods
@@ -80,12 +80,12 @@ Obtains the lock, runs C<&code>, and releases the lock afterwards. Care
80
80
is taken to make sure the lock is released even if the code is left through
81
81
an exception.
82
82
83
- Note that the L<Lock|/type/ Lock> itself needs to be created outside the portion
83
+ Note that the C< Lock> itself needs to be created outside the portion
84
84
of the code that gets threaded and it needs to protect. In the first
85
- example below, L<Lock|/type/ Lock> is first created and assigned to C<$lock>,
86
- which is then used I<inside> the L<Promises |/type/Promise> to protect
85
+ example below, C< Lock> is first created and assigned to C<$lock>,
86
+ which is then used I<inside> the L<C<Promise> |/type/Promise>s to protect
87
87
the sensitive code. In the second example, a mistake is made: the
88
- C<Lock> is created right inside the L<Promise|/type/Promise>, so the code ends up
88
+ C<Lock> is created right inside the L<C< Promise> |/type/Promise>, so the code ends up
89
89
with a bunch of separate locks, created in a bunch of threads, and
90
90
thus they don't actually protect the code we want to protect.
91
91
@@ -156,7 +156,7 @@ calling C<lock> and C<unlock>. Failing that, use a C<LEAVE> phaser.
156
156
157
157
method condition(Lock:D: )
158
158
159
- Returns a L< condition variable as a C<Lock::ConditionVariable> object |/type/Lock/ ConditionVariable>.
159
+ Returns a condition variable as a L< C<Lock::ConditionVariable>|/type/Lock:: ConditionVariable> object .
160
160
Check
161
161
L<this article|https://web.stanford.edu/~ouster/cgi-bin/cs140-spring14/lecture.php?topic=locks> or
162
162
L<the Wikipedia|https://en.wikipedia.org/wiki/Monitor_%28synchronization%29>
0 commit comments