[239] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r414 - trunk/conf.asedeno/owl/modules

daemon@ATHENA.MIT.EDU (asedeno@darkmatter.mit.edu)
Thu Oct 29 18:04:01 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: asedeno@darkmatter.mit.edu
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Fri, 27 Oct 2006 22:21:36 -0400 (EDT)

Author: asedeno
Date: 2006-10-27 22:21:35 -0400 (Fri, 27 Oct 2006)
New Revision: 414

Modified:
   trunk/conf.asedeno/owl/modules/VT-asedeno.pl
   trunk/conf.asedeno/owl/modules/thread_example_1.pl
Log:
Updated VT-style to deal with unhandled messages in a not terrible way.
Updated the threading example to actually construct and queue messages.



Modified: trunk/conf.asedeno/owl/modules/VT-asedeno.pl
===================================================================
--- trunk/conf.asedeno/owl/modules/VT-asedeno.pl	2006-10-27 19:07:59 UTC (rev 413)
+++ trunk/conf.asedeno/owl/modules/VT-asedeno.pl	2006-10-28 02:21:35 UTC (rev 414)
@@ -63,7 +63,7 @@
     }
     else 
     { 
-	return "Unexpected message type: ";    
+	return $m->type.":\t".$m->body;
     }
 }
 

Modified: trunk/conf.asedeno/owl/modules/thread_example_1.pl
===================================================================
--- trunk/conf.asedeno/owl/modules/thread_example_1.pl	2006-10-27 19:07:59 UTC (rev 413)
+++ trunk/conf.asedeno/owl/modules/thread_example_1.pl	2006-10-28 02:21:35 UTC (rev 414)
@@ -29,18 +29,31 @@
     while (1)
     {
 	$semaphore->down();
+	$now = time();
+	$timestr = localtime($now);
 	if ($::shutdown)
 	{
-	      owl::command(qq/aperl "Thread exiting."/);
-	      $semaphore->up();	    
-	      return;
+	    my $m = owl::Message->new('type' => 'generic', 
+				      'direction' => 'in',
+				      'body' => "Thread terminated - $now",
+				      'sender' => 'worker thread',
+				      'recipient' => 'owl client');
+	    
+	    owl::queue_message($m);
+	    
+	    $semaphore->up();	    
+	    return;
 	}
 
-	$now = time();
 	if ($now > $next)
 	{
 	    $next = $now + 3;
-	    owl::command("aperl $now");
+	    my $m = owl::Message->new('type' => 'generic', 
+				      'direction' => 'in',
+				      'body' => "$now",
+				      'sender' => 'worker thread',
+				      'recipient' => 'owl client');
+	    owl::queue_message($m);
 	}
 	$semaphore->up();
     }


home help back first fref pref prev next nref lref last post