<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">I should add for completeness, leaving aside the # of frameworks issue, there is another issue with promoting this to a module as those exist in Swift today: it would necessarily become a public API (by this I mean: API visible to our customers) and one of them would try to use it.</div> <br><p class="airmail_on">On March 23, 2017 at 2:10:48 AM, Drew Crawford (<a href="mailto:drew@sealedabstract.com">drew@sealedabstract.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div></div><div>




<title></title>



<div id="bloop_customfont" style="margin: 0px;">
<div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial; font-size: 13px;">
<blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">
<div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
This fails to convince me.&nbsp;</div>
</blockquote>
</div>
<p style="color: rgb(0, 0, 0); font-family: Helvetica, Arial; font-size: 13px;">
I understand that, but not why.</p>
<p style="color: rgb(0, 0, 0); font-family: Helvetica, Arial; font-size: 13px;">
I can't go into detail in public, but I can say that we did a
postmortem on a large lost sale and the customer specifically cited
the number of frameworks in our product as an integration barrier
for them. &nbsp;Most iOS SDKs are distributed as a single framework
and so with that backdrop the friction makes more sense.</p>
<p style="color: rgb(0, 0, 0); font-family: Helvetica, Arial; font-size: 13px;">
As a result of that I have about 5 bugs open on how to reduce our
framework footprint so our tools are easier for our users to
integrate. &nbsp;There are a variety of solutions we use on that,
what you see here is one of the saner ones, believe it or not.</p>
<p style="color: rgb(0, 0, 0); font-family: Helvetica, Arial; font-size: 13px;">
Whether or not the technical requirement makes sense to you, the
business case is very clear. &nbsp;So clear that if scoped were
removed we would almost certainly keep the file and its potential
threading bugs, over promoting a new framework. &nbsp;Sales
&gt;&gt; code, unfortunately.</p>
<div>
<blockquote type="cite" style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; padding-left: 5px; border-left-width: 1px !important; border-left-color: rgb(0, 64, 128) !important;">
<div id="bloop_customfont" style="margin: 0px;">Once we gain
submodules in the future, it would be even easier to move both
classes to their own sub-module.</div>
</blockquote>
</div>
<div>
<div style="margin: 0px;"><br></div>
</div>
<div style="margin: 0px;">That is a lovely tale but it is not the
proposal in front of us. &nbsp;Perhaps when we get submodules that
solve these visibility problems we can revisit.</div>
</div>
<br>
<p class="airmail_on">On March 23, 2017 at 1:47:20 AM, David Hart
(<a href="mailto:david@hartbit.com">david@hartbit.com</a>)
wrote:</p>
<blockquote type="cite" class="clean_bq">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div><span>Hi Drew Crawford,</span>
<div class=""><span><br class=""></span></div>
<div class=""><span>I understand that scoped private can be of
value, and that code is a good example. But I never argued that
private was useless (it would never have been proposed and accepted
in the first case if it was). I just argue that the advantage is
not worth its presence in the language. Here’s my
take:</span></div>
<div class=""><span><br class=""></span></div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">
<div class=""><span><i class="">3. This file cannot be made an
entire module, because it's actually used as part of
several&nbsp;projects that are shipped as frameworks, and
apparently some developers get really annoyed when&nbsp;they have
to drag too many frameworks into their Xcode
project.</i></span></div>
<div class=""><span><i class=""><br class=""></i></span></div>
</blockquote>
<span>This fails to convince me. If this piece of code is really
used in several projects, I think it belongs in its own module and
I would have implemented it by moving&nbsp;<font face="Menlo" class="">ThreadsafeWrapper</font> to its own file, thus keeping the
same thread-safety guarantees and hiding of your current example.
The feels to me like this piece of code is using <font face="Menlo" class="">private</font> only because it is shying away from using
module-scope. Once we gain submodules in the future, it would be
even easier to move both classes to their own sub-module.</span>
<div class=""><span><br class=""></span></div>
<div class=""><span>David.<br class=""></span>
<div class="">
<div class=""><span><br class=""></span>
<div>
<blockquote type="cite" class="">
<div class=""><span>On 23 Mar 2017, at 06:17, Drew Crawford via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</span></div>
<span><br class="Apple-interchange-newline"></span>
<div class="">
<div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><span>It has been expressed in various ways "does anybody
actually use scoped visibility in the wild" and "what real benefit
does it provide to production code".</span></div>
<div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><span><br class=""></span></div>
<div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><span>The below file or some estranged stepchild of it
appears at least 5 repositories (that I know of; this is
practically a samizdat around here). &nbsp;The scoped access
modifier is a significant improvement to the safety of this code
and by extension the many projects that contain it.</span></div>
<div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><span><br class=""></span></div>
<div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class=""><span>Apologies if this listing is rather tiring.
&nbsp;Many of the "solutions" proposed by the anti-private camp
sound great in a sentence but fall apart at scale. &nbsp;But it is
not obvious why this is so to people who do not use the keyword, so
I can understand why they keep suggesting poor solutions.
&nbsp;Perhaps with a more involved listing, it will become more
obvious why many of these suggestions do not work. &nbsp;The
original is a lot longer; I did reduce it to only the parts that
seem relevant to this thread.</span></div>
<div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span><br class=""></span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">import</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>Foundation</span></span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">/**</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;This code demonstrates one of the usecases for
'private'.&nbsp; Adapted from real production code, this file
exports a threading primitive to the rest of the
program.</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;To state it briefly, private is necessary here
because we need the following visibility nesting to achieve our
objective:</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;┌───────────────────────────────────────────┐</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│PROGRAM/internal &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
│</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp;
┌───────────────────────────────────┐ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │
ThreadsafeWrapperNotifyChanged&nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │&nbsp; &nbsp; &nbsp;
┌──────────────────────┐ &nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │&nbsp; &nbsp; &nbsp; │ &nbsp;
ThreadsafeWrapper&nbsp; │ &nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │&nbsp; &nbsp; &nbsp; │&nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │
&nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │&nbsp; &nbsp; &nbsp; │&nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │
&nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │&nbsp; &nbsp; &nbsp; │&nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; value &nbsp; &nbsp; &nbsp; │ &nbsp; &nbsp; │
│</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │&nbsp; &nbsp; &nbsp; │&nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │
&nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │&nbsp; &nbsp; &nbsp; │&nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │
&nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │&nbsp; &nbsp; &nbsp;
└──────────────────────┘ &nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp; │ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; │ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;│ &nbsp; &nbsp;
└───────────────────────────────────┘ │</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;└───────────────────────────────────────────┘</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;In particular:</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;1.&nbsp; value a.k.a. "t" must be protected against
all potential unsafe access.&nbsp; This file is hundreds of lines,
auditing the whole thing is very tedious.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;2.&nbsp; ThreadsafeWrapper is an implementation
detail of ThreadsafeWrapperNotifyChanged which is not intended for
use by other callers.&nbsp; To avoid exposing the class to other
callers, it must appear in this file.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;3.&nbsp; This file cannot be made an entire module,
because it's actually used as part of several projects that are
shipped as frameworks, and apparently some developers get really
annoyed when they have to drag too many frameworks into their Xcode
project.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;4.&nbsp; The use of `private` here reduces the
"maybe not threadsafe" part of the code from 196 lines to 47 lines
(a reduction of buggy code of 76%).&nbsp; In the production file
from which this example is derived, the reduction is from 423 lines
to 33 lines, or 92%.&nbsp; A scoped access variable significantly
improves the threadsafety of this code.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0); min-height: 13px;" class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;*/</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">//Define an interface common to both major
components</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">private</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>Threadsafe
:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///the type
of the value we are protecting</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">associatedtype</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>T</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///Access
the underlying value.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///-<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">parameter</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block: The
block that will be passed the protected value.&nbsp; The block acts
as an exclusive lock; while you're in it, no other consumers will
be accessing the value. &nbsp;</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///-<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">complexity</span><span style="font-variant-ligatures: no-common-ligatures;" class="">:
Coalescing multiple operations into a single block improves
performance.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>accessT&lt;K&gt;(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">@escaping</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(T)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///Mutate
the underlying value.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///-<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">parameter</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block: The
block that will be passed the protected value.&nbsp; The block acts
as an exclusive lock; while you're in it, no other consumers will
be accessing the value.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///-<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">complexity</span><span style="font-variant-ligatures: no-common-ligatures;" class="">:
Coalescing multiple operations into a single block improves
performance.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>mutateT&lt;K&gt;(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">@escaping</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(inout
T)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">///Some convenience accessors for callers that do not need
a block-based API to get lock semantics / operation
coalescing</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">Threadsafe</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>value : T
{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">get</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>t: T!
=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">nil</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class="">!<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">accessT</span><span style="font-variant-ligatures: no-common-ligatures;" class="">({
lt<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t
= lt</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>t</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">set</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class="">!<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">mutateT</span><span style="font-variant-ligatures: no-common-ligatures;" class="">({
(lt:</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">inout</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>T) -&gt;
()<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lt
= newValue</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">///The core synchronization primitive.&nbsp; This is a
private implementation detail of
ThreadsafeWrapperNotifyChanged.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">//MARK: audit this area begin</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">private</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">final</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>ThreadsafeWrapper&lt;T&gt;
:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Threadsafe</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">/**The
value we are protecting.&nbsp; This value needs to be protected
against unsafe access from</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; 1.&nbsp; This type, if a scoped keyword is
available (as shown)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; 2.&nbsp; The entire file, if a scoped
keyword is removed.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp; Only access this value on the
synchronizationQueue.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp; */</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">private</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>t:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///The
queue that is used to synchronize the value, only access the value
from the queue.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///-<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">note</span><span style="font-variant-ligatures: no-common-ligatures;" class="">:
fileprivate is used here to allow the wrapped object to access the
queue.&nbsp; Demonstrating that both are legitimately useful
modifiers.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">fileprivate</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>synchronizationQueue:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">DispatchQueue</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">internal</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(t:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,
queueDescription:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)
{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">synchronizationQueue</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">DispatchQueue</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(label:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(180, 38, 26);" class="">"foo"</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">t</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>=
t</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">//MARK:
implement our Threadsafe protocol</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>accessT&lt;K&gt;(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">@escaping</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>k :<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">!</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>err:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Error</span><span style="font-variant-ligatures: no-common-ligatures;" class="">?</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">synchronizationQueue</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">sync</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()
{[unowned<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">] ()
-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Void</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">do</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>k =
block(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">t</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)
}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">catch</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{ err = error
}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>err = err
{<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throw</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>err
}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>k</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>mutateT&lt;K&gt;(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">@escaping</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(inout<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>k :<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">!</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>err:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Error</span><span style="font-variant-ligatures: no-common-ligatures;" class="">?</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">synchronizationQueue</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">sync</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()
{[unowned<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">] ()
-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Void</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">do</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{ k
=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">fastMutateT</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(block)
}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">catch</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{ err = error
}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>err = err
{<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throw</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>err
}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>k</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///An
alternate mutation function that can only be used when inside a
block already.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///-<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">note</span><span style="font-variant-ligatures: no-common-ligatures;" class="">: Calling
this function from the wrong queue is NOT thread-unsafe, it will
merely crash the program.&nbsp; So exposing this API to the file
may introduce bugs, but none of them are a threadsafety
concern.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>fastMutateT&lt;K&gt;(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">@escaping</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(inout<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">dispatchPrecondition</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(condition:
.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">onQueue</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">synchronizationQueue</span><span style="font-variant-ligatures: no-common-ligatures;" class="">))</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block(&amp;</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">t</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">//MARK: audit area end</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">/**Like ThreadsafeWrapper, but also allows us to find out
when the wrapped object changes.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;For that reason, it has a little more overhead than
ThreadsafeWrapper, and requires the wrapped type to be equatable
*/</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">final</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>ThreadsafeWrapperNotifyChanged&lt;T:
Equatable&gt; :<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Threadsafe</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">///Hold the
value and a list of semaphores</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">private</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>tsw:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">ThreadsafeWrapper</span><span style="font-variant-ligatures: no-common-ligatures;" class="">&lt;(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,
[</span><span style="font-variant-ligatures: no-common-ligatures;" class="">DispatchSemaphore</span><span style="font-variant-ligatures: no-common-ligatures;" class="">])&gt;</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">internal</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(t:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,
queueDescription:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)
{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">tsw</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">ThreadsafeWrapper</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(t: (t,
[]), queueDescription:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(180, 38, 26);" class="">"foo"</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">//MARK:
implement our Threadsafe protocol</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>mutateT&lt;K&gt;(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">@escaping</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(inout<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>k :<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">!</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">tsw</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">mutateT</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{ v<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">defer</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">for</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>sema<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>v.1
{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; sema.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">signal</span><span style="font-variant-ligatures: no-common-ligatures;" class="">()</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">tsw</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">fastMutateT</span><span style="font-variant-ligatures: no-common-ligatures;" class="">({
v<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block(&amp;v.0)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>k</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>accessT&lt;K&gt;(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">@escaping</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">tsw</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">accessT</span><span style="font-variant-ligatures: no-common-ligatures;" class="">({ v
-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">K</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>block(v.0)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; })</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">/**Notify
when the value passed in has changed or the timeout has
expired.</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp; By passing a particular value, we can
avoid many race conditions.*/</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>waitForChange(oldValue:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">T</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,
timeOut:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">TimeInterval</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throws</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>sema
:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">DispatchSemaphore</span><span style="font-variant-ligatures: no-common-ligatures;" class="">!
=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">nil</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>oldValue
!=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">tsw</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">value</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.0
{<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>}<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">//fastpath</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">//slowpath</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">accessT</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{[unowned<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">] (tee)
-&gt; ()<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>oldValue != tee
{<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sema
=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">DispatchSemaphore</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(value:
0)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">tsw</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">fastMutateT</span><span style="font-variant-ligatures: no-common-ligatures;" class="">({
v<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
v.1.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">append</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(sema)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>sema
==<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">nil</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">//clean up
semaphore again</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">defer</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class="">!<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">tsw</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">mutateT</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{ v<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
v.1.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">removeItemMatchingReference</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(sema)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>time
=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">DispatchTime</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">now</span><span style="font-variant-ligatures: no-common-ligatures;" class="">() +
timeOut</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>sema.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">wait</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(timeout:
time)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">==</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">timedOut</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">throw</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Errors</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">DeadlineExceeded</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">//now, did
we change?</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>changed
=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">accessT</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{ (val)
-&gt;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Bool</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">in</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>val !=
oldValue</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>changed
{<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">return</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">try</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">waitForChange</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(oldValue:
oldValue, timeOut: timeOut)<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">//</span><span style="line-height: normal; font-family: 'Apple Color Emoji'; font-variant-ligatures: no-common-ligatures; color: rgb(0, 143, 0);" class="">🐞</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">//MARK: utility</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>Errors:<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">Error</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>DeadlineExceeded</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">RangeReplaceableCollection</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">where</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>Iterator.Element
: AnyObject {</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 128, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">/// Remove
first colleciton element that matches the given
reference</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">mutating</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">func</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>removeItemMatchingReference(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>object :
Iterator.Element) {</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space">&nbsp;</span>index
=<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">index</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(where: {$0
=== object}) {</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(4, 51, 255);" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 149, 175);" class="">remove</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(at:
index)</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp; }</span></div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""></p>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div>
</div>
<br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<p class="airmail_on" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
On March 20, 2017 at 6:54:55 PM, Douglas Gregor (<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>)
wrote:</p>
<blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">
<div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div class=""></div>
<div class="">
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">Hello Swift community,</span></p>
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">The review of SE-0159 "Fix Private Access Levels"
begins now and runs through March 27, 2017. The proposal is
available here:</span></p>
<blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); background-color: rgb(255, 255, 255);">
<div class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px;">
<span class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md" class=""><font color="#6A737D" face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md</font></a></span></div>
</blockquote>
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">Reviews are an important part of the Swift evolution
process. All reviews should be sent to the swift-evolution mailing
list at</span></p>
<blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; color: rgb(106, 115, 125); border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<div class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px;">
<span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(3, 102, 214); text-decoration: none;">
https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></div>
</blockquote>
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">or, if you would like to keep your feedback private,
directly to the review manager. When replying, please try to keep
the proposal link at the top of the message:</span></p>
<blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); background-color: rgb(255, 255, 255);">
<p class="" style="color: rgb(106, 115, 125); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; box-sizing: border-box; margin-top: 0px; margin-bottom: 16px;">
<span class="">Proposal link:</span></p>
<blockquote class="" style="box-sizing: border-box; margin: 0px; padding: 0px 1em; border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229);">
<div class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px;">
<span class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md" class=""><font color="#6A737D" face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0159-fix-private-access-levels.md</font></a></span></div>
</blockquote>
</blockquote>
<blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; color: rgb(106, 115, 125); border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<div class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px;">
<span class="">Reply text</span></div>
</blockquote>
<blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; color: rgb(106, 115, 125); border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<blockquote class="" style="box-sizing: border-box; margin: 0px; padding: 0px 1em; border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229);">
<div class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px;">
<span class="">Other replies</span></div>
</blockquote>
</blockquote>
<h5 class="" style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 0.875em; line-height: 1.25; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);">
<span class=""><a id="user-content-what-goes-into-a-review-1" class="anchor" href="https://github.com/apple/swift-evolution/blob/master/process.md#what-goes-into-a-review-1" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(3, 102, 214); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;">
<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg></a>What goes into a review?</span></h5>
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">The goal of the review process is to improve the
proposal under review through constructive criticism and,
eventually, determine the direction of Swift. When writing your
review, here are some questions you might want to answer in your
review:</span></p>
<ul class="" style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<li class="" style="box-sizing: border-box;"><span class="">What is
your evaluation of the proposal?</span></li>
<li class="" style="box-sizing: border-box; margin-top: 0.25em;">
<span class="">Is the problem being addressed significant enough to
warrant a change to Swift?</span></li>
<li class="" style="box-sizing: border-box; margin-top: 0.25em;">
<span class="">Does this proposal fit well with the feel and
direction of Swift?</span></li>
<li class="" style="box-sizing: border-box; margin-top: 0.25em;">
<span class="">If you have used other languages or libraries with a
similar feature, how do you feel that this proposal compares to
those?</span></li>
<li class="" style="box-sizing: border-box; margin-top: 0.25em;">
<span class="">How much effort did you put into your review? A
glance, a quick reading, or an in-depth study?</span></li>
</ul>
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">More information about the Swift evolution process
is available at</span></p>
<blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; color: rgb(106, 115, 125); border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<div class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px;">
<span class=""><a href="https://github.com/apple/swift-evolution/blob/master/process.md" class="" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(3, 102, 214); text-decoration: none;">
https://github.com/apple/swift-evolution/blob/master/process.md</a></span></div>
</blockquote>
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">Thank you,</span></p>
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">-Doug</span></p>
<p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">
<span class="">Review Manager</span></p>
<span class="">_______________________________________________<br class="">
swift-evolution-announce mailing list<br class="">
<a href="mailto:swift-evolution-announce@swift.org" class="">swift-evolution-announce@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution-announce" class="">https://lists.swift.org/mailman/listinfo/swift-evolution-announce</a><br class="">
</span></div>
</div>
</blockquote>
<span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div>
</blockquote>
</div>
<br class=""></div>
</div>
</div>
</div>
</div>
</blockquote>


</div></div></span></blockquote></body></html>