Index: doc/theses/colby_parsons_MMath/code/basic_actor_example.cfa
===================================================================
--- doc/theses/colby_parsons_MMath/code/basic_actor_example.cfa	(revision f945fa7ba076d346ab1aa115747f79712d70331d)
+++ doc/theses/colby_parsons_MMath/code/basic_actor_example.cfa	(revision f945fa7ba076d346ab1aa115747f79712d70331d)
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <string.h>
+#include <actor.hfa>
+
+struct derived_actor {
+    inline actor;       // Plan-9 C nominal inheritance
+};
+void ?{}( derived_actor & this ) { // Default constructor definition
+    ((actor &)this){};  // Call to actor constructor
+}
+
+struct derived_msg {
+    inline message;     // Plan-9 C nominal inheritance
+    char word[12];
+};
+void ?{}( derived_msg & this, char * new_word ) { // Overload constructor definition
+    ((message &) this){ Finished }; // Call to message constructor passing allocation status
+    strcpy(this.word, new_word);
+}
+
+allocation receive( derived_actor & receiver, derived_msg & msg ) {
+    printf("The message contained the string: %s\n", msg.word);
+    return Finished; // Return allocation status of Finished now that the actor is done work
+}
+
+int main() {
+    start_actor_system(); // Sets up executor. Actors and messages can be created after this point.
+    derived_actor my_actor;         
+    derived_msg my_msg{ "Hello World" }; // Constructor call
+    my_actor | my_msg;   // All message sends are done through the bar operator
+    stop_actor_system(); // Waits until all actors are finished
+    return 0;
+}
Index: doc/theses/colby_parsons_MMath/code/swap_queues.cfa
===================================================================
--- doc/theses/colby_parsons_MMath/code/swap_queues.cfa	(revision f945fa7ba076d346ab1aa115747f79712d70331d)
+++ doc/theses/colby_parsons_MMath/code/swap_queues.cfa	(revision f945fa7ba076d346ab1aa115747f79712d70331d)
@@ -0,0 +1,53 @@
+// sequential equivalent swap
+void swap( uint victim_idx, uint my_idx  ) {
+    // Step 0:
+    work_queue * my_queue = request_queues[my_idx];
+    work_queue * vic_queue = request_queues[victim_idx];
+    // Step 2:
+    request_queues[my_idx] = 0p;
+    // Step 3:
+    request_queues[victim_idx] = my_queue;
+    // Step 4:
+    request_queues[my_idx] = vic_queue;
+}
+
+// This routine is atomic
+bool CAS( work_queue ** ptr, work_queue ** old, work_queue * new ) {
+    if ( *ptr != *old )
+        return false;
+    *ptr = new;
+    return true;
+}
+
+bool try_swap_queues( worker & this, uint victim_idx, uint my_idx ) with(this) {
+    // Step 0:
+    // request_queues is the shared array of all sharded queues
+    work_queue * my_queue = request_queues[my_idx];
+    work_queue * vic_queue = request_queues[victim_idx];
+
+    // Step 1:
+    // If either queue is 0p then they are in the process of being stolen
+    // 0p is CForAll's equivalent of C++'s nullptr
+    if ( vic_queue == 0p ) return false;
+
+    // Step 2:
+    // Try to set thief's queue ptr to be 0p.
+    // If this CAS fails someone stole thief's queue so return false
+    if ( !CAS( &request_queues[my_idx], &my_queue, 0p ) )
+        return false;
+    
+    // Step 3:
+    // Try to set victim queue ptr to be thief's queue ptr.
+    // If it fails someone stole the other queue, so fix up then return false
+    if ( !CAS( &request_queues[victim_idx], &vic_queue, my_queue ) ) {
+        request_queues[my_idx] = my_queue; // reset queue ptr back to prev val
+        return false;
+    }
+
+    // Step 4:
+    // Successfully swapped.
+    // Thief's ptr is 0p so no one will touch it
+    // Write back without CAS is safe
+    request_queues[my_idx] = vic_queue;
+    return true;
+}
