[prev in list] [next in list] [prev in thread] [next in thread]
List: e-lang
Subject: Re: [e-lang] Techniques for batching messages
From: "Dean Tribble" <tribble () e-dean ! com>
Date: 2006-11-18 3:00:28
Message-ID: 1f5af2f10611171900s51e3bd0fx1e28a5b61cab99e6 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
This is an important pattern because it allows an event loop to merge calls
(e.g., redisplay events), suppress duplicates, etc. Very nice.
On 11/17/06, Kevin Reid <kpreid@attglobal.net> wrote:
>
>
> # This will send at most one message per cycle of the vat.
>
> def buffer := <something mutable>
>
> def flush() {
> recipient <- (buffer.snapshot())
> buffer.removeAll()
> }
>
> def input(data) {
> if (buffer.empty()) {
> flush <- ()
> }
> buffer.append(data)
> }
>
>
> # This version will send a message only after one cycle with no input
> # being added.
>
> def buffer := <something mutable>
> var currentTag := null
>
> def flush(tag) {
> if (tag == currentTag) {
> recipient <- (buffer.snapshot())
> buffer.removeAll()
> }
> }
>
> def input(data) {
> if (buffer.empty()) {
> flush <- (currentTag := def aTag {})
> }
> buffer.append(data)
> }
>
>
>
> --
> Kevin Reid <http://homepage.mac.com/kpreid/>
>
>
> _______________________________________________
> e-lang mailing list
> e-lang@mail.eros-os.org
> http://www.eros-os.org/mailman/listinfo/e-lang
>
[Attachment #5 (text/html)]
This is an important pattern because it allows an event loop to merge calls (e.g., \
redisplay events), suppress duplicates, etc. Very nice.<br><br><div><span \
class="gmail_quote">On 11/17/06, <b class="gmail_sendername">Kevin Reid </b> <<a \
href="mailto:kpreid@attglobal.net">kpreid@attglobal.net</a>> \
wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br> # This will send at \
most one message per cycle of the vat.<br><br>def buffer := <something \
mutable><br><br>def flush() {<br> recipient <- \
(buffer.snapshot())<br> buffer.removeAll()<br>}<br><br>def input(data) { \
<br> if (buffer.empty()) {<br> flush <- \
()<br> }<br> buffer.append(data)<br>}<br><br><br># This \
version will send a message only after one cycle with no input<br># being \
added.<br><br>def buffer := <something mutable> <br>var currentTag := \
null<br><br>def flush(tag) {<br> if (tag == currentTag) \
{<br> recipient <- \
(buffer.snapshot())<br> buffer.removeAll()<br> \
}<br>}<br><br>def input(data) {<br> if (buffer.empty()) {<br> \
flush <- (currentTag := def aTag {})<br> \
}<br> buffer.append(data)<br>}<br><br><br><br>--<br>Kevin \
Reid &nbs \
p; <<a \
href="http://homepage.mac.com/kpreid/">http://homepage.mac.com/kpreid/</a> \
><br><br><br>_______________________________________________<br>e-lang mailing \
list<br><a href="mailto:e-lang@mail.eros-os.org">e-lang@mail.eros-os.org</a><br><a \
href="http://www.eros-os.org/mailman/listinfo/e-lang">http://www.eros-os.org/mailman/listinfo/e-lang
</a><br></blockquote></div><br>
_______________________________________________
e-lang mailing list
e-lang@mail.eros-os.org
http://www.eros-os.org/mailman/listinfo/e-lang
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic