[235] in BarnOwl Developers

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

[D-O-H] r412 - in trunk/conf.asedeno/owl: . modules

daemon@ATHENA.MIT.EDU (asedeno@darkmatter.mit.edu)
Thu Oct 29 18:03:59 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 15:01:07 -0400 (EDT)

Author: asedeno
Date: 2006-10-27 15:01:06 -0400 (Fri, 27 Oct 2006)
New Revision: 412

Modified:
   trunk/conf.asedeno/owl/modules/VT-asedeno.pl
   trunk/conf.asedeno/owl/modules/thread_example_1.pl
   trunk/conf.asedeno/owl/owlconf.pl
Log:
More updates to my conf files.



Modified: trunk/conf.asedeno/owl/modules/VT-asedeno.pl
===================================================================
--- trunk/conf.asedeno/owl/modules/VT-asedeno.pl	2006-10-27 17:39:46 UTC (rev 411)
+++ trunk/conf.asedeno/owl/modules/VT-asedeno.pl	2006-10-27 19:01:06 UTC (rev 412)
@@ -49,13 +49,17 @@
     {	
 	return format_VT($m);
     }
+    elsif ($m->is_aim)
+    {
+	return format_VT_AIM($m);
+    }
     elsif ($m->is_admin)
     {
-	return "\@bold(OWL ADMIN):\t".$m->body;    
+	return "\@bold(OWL ADMIN):\t".$m->body;
     }
-    elsif ($m->is_aim)
+    elsif ($m->type eq 'loopback')
     {
-	return format_VT_AIM($m);
+	return "\@bold(loopback):  ".$m->body;
     }
     else 
     { 

Modified: trunk/conf.asedeno/owl/modules/thread_example_1.pl
===================================================================
--- trunk/conf.asedeno/owl/modules/thread_example_1.pl	2006-10-27 17:39:46 UTC (rev 411)
+++ trunk/conf.asedeno/owl/modules/thread_example_1.pl	2006-10-27 19:01:06 UTC (rev 412)
@@ -1,6 +1,5 @@
 package thread_example_1;
 use threads;
-use Thread::Queue;
 use Thread::Semaphore;
 
 my $semaphore = new Thread::Semaphore(0);
@@ -15,7 +14,7 @@
 sub onMainLoop
 {
      $semaphore->up();
-#     threads->yield();
+     threads->yield();
      $semaphore->down();
 }
 push @::onMainLoop, \&onMainLoop;

Modified: trunk/conf.asedeno/owl/owlconf.pl
===================================================================
--- trunk/conf.asedeno/owl/owlconf.pl	2006-10-27 17:39:46 UTC (rev 411)
+++ trunk/conf.asedeno/owl/owlconf.pl	2006-10-27 19:01:06 UTC (rev 412)
@@ -49,7 +49,6 @@
 ###
 ################################################################################
 
-
 # Arrays of function pointers to be called at specific times.
 our @onStartSubs = undef;
 our @onReceiveMsg = undef;
@@ -62,7 +61,6 @@
 
 use threads;
 use threads::shared;
-use Thread::Queue;
 
 # Shared thread shutdown flag.
 # Consider adding a reload flag, so threads that should persist across reloads
@@ -71,7 +69,7 @@
 our $shutdown : shared;
 $shutdown = 0;
 
-sub owl::mainloop_hook
+sub mainloop_hook
 {
     foreach (@onMainLoop)
     {
@@ -102,7 +100,7 @@
 # At this point I use owl::shutdown to tell any auxillary threads that they
 # should terminate.
     $shutdown = 1;
-    owl::mainloop_hook();
+    mainloop_hook();
 }
 
 #Run this on start and reload. Adds modules and runs their startup functions.
@@ -129,7 +127,7 @@
 	&$_();
     }
 
-    owl::command(qq/set -q perl_mainloop_hook "owl::mainloop_hook"/);
+    owl::command(qq/set -q perl_mainloop_hook "mainloop_hook"/);
 
 }
 ################################################################################
@@ -141,21 +139,25 @@
     # code you want to happen on a reload.  I suggest you create
     # load_filters() and run it from here and owl::startup()
     # because owl::command() must be in a sub
+    
     onStart();
     return 1;
 }
 
 sub reload 
 {
+    # Unhook ourselves from the mainloop.
+    owl::command(qq/set -q perl_mainloop_hook NULL/);
     # Shutdown existing threads.
     $shutdown = 1;
-    owl::mainloop_hook();
+    mainloop_hook();
     $shutdown = 0;
-
+    @onMainLoop = ();
+    
     # Do reload
-    if (do "$ENV{HOME}/.owlconf" && reload_hook(@_)) 
+    if (do "$ENV{HOME}/.owlconf" && reload_hook(@_))
     {
-        return "owlconf reloaded";
+	return "owlconf reloaded";
     } 
     else
     {
@@ -180,7 +182,6 @@
     my @modules = grep(/\.pl$/, readdir(MODULES));
     foreach my $mod (@modules)
     {
-	
 	do "$ENV{HOME}/.owl/modules/$mod";
     }
     closedir(MODULES);
@@ -225,3 +226,5 @@
     owl::command(qq/pperl "$helpmsg"/);
 }
 
+# Keeps reloads happy.
+1;


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