Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is a sketch of an approach that improves fairness - it will mean that <em>all</em> <code>B</code>-sends are subject to a delay of up to 100ms. I don't know however if it fits with your constraints.</p> <ul> <li>In a global context, have a single <code>MessageSender</code> object of type <code>IMessageSender</code></li> <li>There are two implementations of <code>IMessageSender</code>, namely <code>DefaultMessageSender</code>, and <code>BWrappingMessageSender</code> (which stores a <code>b</code> value)</li> </ul> <p>The message senders behaviour is as follows:</p> <ul> <li><code>DefaultMessageSender</code> on being asked to send an <code>A</code>: just sends it</li> <li><p><code>DefaultMessageSender</code> on being asked to send an <code>B</code>: switches the global <code>MessageSender</code> to being a new <code>BWrappingMessageSender</code> which knows the just-passed value <code>b</code></p></li> <li><p><code>BWrappingMessageSender</code> on being asked to send an <code>A</code>: sends an AB with the passed <code>a</code> and its own <code>b</code>, and switches the global <code>MessageSender</code> to being a <code>DefaultMessageSender</code></p></li> <li><code>BWrappingMessageSender</code> on being asked to send a <code>B</code>: sends a <code>B</code> with its own <code>b</code>, and switches the global <code>MessageSender</code> to being a new <code>BWrappingMessageSender</code> which knows the just-passed value <code>b</code></li> </ul> <p>What I haven't pinned down is a way that a newly-created <code>BWrappingMessageSender</code> knows to send a plain <code>B</code> 100ms after being created, if it hasn't in that time been told to do anything else.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload