Index: doc/theses/colby_parsons_MMAth/text/waituntil.tex
===================================================================
--- doc/theses/colby_parsons_MMAth/text/waituntil.tex	(revision f496046ba2faf27a2bbae7028f7005b58ac592ee)
+++ doc/theses/colby_parsons_MMAth/text/waituntil.tex	(revision 000d68fa1bff51eb40c559cdf944cdb21cfa48e2)
@@ -163,9 +163,10 @@
 
 Another example of programming-language \gls{synch_multiplex} is Go using a @select@ statement with channels~\cite{go:selectref}.
-Figure~\ref{l:BB_Go} shows the outline of a bounded buffer implemented with a Go routine.
+Figure~\ref{l:BB_Go} shows the outline of a bounded buffer administrator implemented with a Go routine.
 Here two channels are used for inserting and removing by client producers and consumers, respectively.
-(The @term@ and @stop@ channels are used to synchronize with the program main.)
+(The @done@ channel is used to synchronize with the program main.)
 Go's @select@ has the same exclusive-or semantics as the ALT primitive from Occam and associated code blocks for each clause like ALT and Ada.
 However, unlike Ada and ALT, Go does not provide guards for the \lstinline[language=go]{case} clauses of the \lstinline[language=go]{select}.
+As such, the exponential blowup can be seen comparing Go and \uC in Figure~\label{f:AdaMultiplexing}.
 Go also provides a timeout via a channel and a @default@ clause like Ada @else@ for asynchronous multiplexing.
 
@@ -175,21 +176,41 @@
 \begin{lrbox}{\myboxA}
 \begin{lstlisting}[language=go,literate=]
+insert := make( chan int )
+remove := make( chan * int )
+buffer := make( chan int Size )
+done := make( chan int )
+count := 0
+func in_buf( int val ) {
+    buffer <- val
+    count++
+}
+func out_buf( int * ptr ) {
+    *ptr := <-buffer
+    count--
+}
+func BoundedBuffer {
+    L: for {
+        if ( count < Size && count > 0 ) {
+            select { // wait for message
+                case i := <- insert: in_buf( i )
+                case p := <- remove: out_buf( p )
+                case <- done: break L
+            }
+        } else if ( count < Size ) {
+            select { // wait for message
+                case i := <- insert: in_buf( i )
+                case <- done: break L
+            }
+        } else ( count > 0 ) {
+            select { // wait for message
+                case p := <- remove: out_buf( p )
+                case <- done: break L;
+            }
+        }
+    }
+    done <- 0
+}
 func main() {
-	insert := make( chan int, Size )
-	remove := make( chan int, Size )
-	term := make( chan string )
-	finish := make( chan string )
-
-	buf := func() {
-		L: for {
-			select { // wait for message
-			  case i = <- buffer:
-			  case <- term: break L
-			}
-			remove <- i;
-		}
-		finish <- "STOP" // completion
-	}
-	go buf() // start thread in buf
+	go BoundedBuffer() // start administrator
 }
 
@@ -203,14 +224,18 @@
 \begin{lstlisting}[language=uC++=]
 _Task BoundedBuffer {
-	... // buffer declarations
-	int count = 0;
+	int * buffer;
+	int front = back = count = 0;
   public:
+    // ... constructor implementation
 	void insert( int elem ) {
-		... // add to buffer
+		buffer[front] = elem;
+        front = ( front + 1 ) % Size;
 		count += 1;
 	}
 	int remove() {
-		... // remove and return from buffer
+		int ret = buffer[back];
+        back = ( back + 1 ) % Size;
 		count -= 1;
+        return ret;
 	}
   private:
@@ -240,4 +265,5 @@
 The @_Select@ statement extends the ALT/Go @select@ by offering both @and@ and @or@ semantics, which can be used together in the same statement.
 Both @_Accept@ and @_Select@ statements provide guards for multiplexing clauses, as well as, timeout, and @else@ clauses.
+Figure~\ref{l:BB_uC++} shows the outline of a bounded buffer administrator implemented with \uC @_Accept@ statements.
 
 There are other languages that provide \gls{synch_multiplex}, including Rust's @select!@ over futures~\cite{rust:select}, OCaml's @select@ over channels~\cite{ocaml:channel}, and C++14's @when_any@ over futures~\cite{cpp:whenany}.
@@ -741,33 +767,31 @@
 		when_conditions[node] = true;
 
-if ( any when_conditions[node] == true ) {
-
-select_nodes nodes[N];									$\C{// declare N select nodes}$
-try {
-    // ... set statuses for nodes with when_conditions[node] == false ...
-
-    for ( node in nodes )								$\C{// register nodes}$
-        if ( when_conditions[node] )
-            register_select( resource, node );
-
-    while ( !check_completion( nodes ) ) {	$\C{// check predicate}$
-        // block
-        for ( resource in waituntil statement ) {	$\C{// run true code blocks}$
-            if ( check_completion( nodes ) ) break;
-            if ( resource is avail )
-                try {
-                    if( on_selected( resource ) )	$\C{// conditionally run block}$
-                        run code block
-                } finally							$\C{// for exception safety}$
-                    unregister_select( resource, node ); $\C{// immediate unregister}$
+if ( any when_conditions[node] are true ) {
+    select_nodes nodes[N];									$\C{// declare N select nodes}$
+    try {
+        // ... set statuses for nodes with when_conditions[node] == false ...
+
+        for ( node in nodes )								$\C{// register nodes}$
+            if ( when_conditions[node] )
+                register_select( resource, node );
+
+        while ( !check_completion( nodes ) ) {	$\C{// check predicate}$
+            // block
+            for ( resource in waituntil statement ) {	$\C{// run true code blocks}$
+                if ( check_completion( nodes ) ) break;
+                if ( resource is avail )
+                    try {
+                        if( on_selected( resource ) )	$\C{// conditionally run block}$
+                            run code block
+                    } finally							$\C{// for exception safety}$
+                        unregister_select( resource, node ); $\C{// immediate unregister}$
+            }
         }
+    } finally {											$\C{// for exception safety}$
+        for ( registered nodes in nodes )					$\C{// deregister nodes}$
+            if ( when_conditions[node] && unregister_select( resource, node )
+                    && on_selected( resource ) ) 
+                run code block							$\C{// run code block upon unregister}\CRT$
     }
-} finally {											$\C{// for exception safety}$
-	for ( registered nodes in nodes )					$\C{// deregister nodes}$
-		if ( when_conditions[node] && unregister_select( resource, node )
-				&& on_selected( resource ) ) 
-			run code block							$\C{// run code block upon unregister}\CRT$
-}
-
 }
 \end{cfa}
@@ -914,5 +938,5 @@
 \setlength{\tabcolsep}{5pt}
 
-\caption{Throughput (channel operations per second) of \CFA and Go for a pathologically case for contention in Go's select implementation}
+\caption{Throughput (channel operations per second) of \CFA and Go in a pathological case for contention in Go's select implementation}
 \label{t:pathGo}
 \begin{tabular}{r|r|r}
