about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-06-11 00:12:45 +0200
committerhut <hut@lavabit.com>2009-06-11 14:51:38 +0200
commit2cf9236d6a2a53de175338071f784db39b261b9e (patch)
treee71766cd1c5bb29bc51678ef411d35f49a728cea /code
parentd73f76fc9ed1bf9eeb0ace66d80e7abd55663e3a (diff)
downloadranger-2cf9236d6a2a53de175338071f784db39b261b9e.tar.gz
fixed.
Diffstat (limited to 'code')
-rw-r--r--code/fm.rb41
1 files changed, 26 insertions, 15 deletions
diff --git a/code/fm.rb b/code/fm.rb
index 85e60489..3b5ff852 100644
--- a/code/fm.rb
+++ b/code/fm.rb
@@ -7,6 +7,17 @@ OPTIONS = {
 	'filepreview' => true,
 }
 
+class Void
+	oldv, $-v = $-v, nil
+
+	for method in instance_methods
+		remove_method(method) rescue nil
+	end
+
+	def self.method_missing(*a) end
+
+	$-v = oldv
+end
 
 module Fm
 	SCHEDULER_PRIORITY = -1
@@ -40,7 +51,7 @@ module Fm
 		# Read the .fmrc
 		@fmrc = File.expand_path('~/.fmrc')
 		if (File.exists?(@fmrc))
-			loaded = Marshal.load(File.read(@fmrc))
+			loaded = Marshal.load(File.read(@fmrc)) rescue nil
 			if Hash === loaded
 				@memory.update(loaded)
 			end
@@ -73,23 +84,23 @@ module Fm
 		pwd ||= @pwd.path || Dir.getwd
 		# This thread inspects directories
 		@scheduler_active = false
-		if defined? @scheduler and Thread === @scheduler
-			@scheduler.kill
+		if defined? @mcheduler and Thread === @mcheduler
+			@mcheduler.kill
 		end
-		@scheduler = Thread.new do
+		@mcheduler = Thread.new do
 			while true
-				Thread.stop
+#				Thread.stop
+				sleep 0.1
 				if @scheduler_active and !SCHEDULED.empty?
-#					@mutex.synchronize {
-						while dir = SCHEDULED.shift
-							dir.refresh(true)
-							dir.resize
-							force_update
-						end
-#					}
+					while dir = SCHEDULED.shift
+						dir.refresh(true)
+						dir.resize
+						force_update
+					end
 				end
 			end
 		end
+		@scheduler = Void
 		@scheduler.priority = SCHEDULER_PRIORITY
 
 
@@ -142,9 +153,9 @@ module Fm
 				draw()
 			rescue Interrupt
 				on_interrupt
-			rescue Exception
-				log($!)
-				log(caller)
+#			rescue Exception
+#				log($!)
+#				log(caller)
 			end
 
 			begin