about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-19 23:21:48 +0200
committerhut <hut@lavabit.com>2009-07-19 23:21:48 +0200
commit0a0c06e37f8a236cf780ee822357e5c59e197d5c (patch)
tree4b3548d24a186440e137b621226e217c44c1eea1 /code
parentb1040ca5c9b4d630b99d54d5f9b63c3bafd5a7a3 (diff)
downloadranger-0a0c06e37f8a236cf780ee822357e5c59e197d5c.tar.gz
replaced EVIL with Option.evil, moved explanation to scheduler.rb
Diffstat (limited to 'code')
-rw-r--r--code/scheduler.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/code/scheduler.rb b/code/scheduler.rb
index e35f28d6..1ca4915e 100644
--- a/code/scheduler.rb
+++ b/code/scheduler.rb
@@ -12,8 +12,15 @@ module Scheduler
 		@active = false
 
 		@thread ||= Thread.new do
-			if EVIL
+			## I have two ways of doing this. the first is somewhat better
+			## but leads to problems with ncurses:
+			## sometimes if you close the terminal window by clicking on
+			## the X or pressing alt+F4 or in any other way that the window
+			## manager provides, it will not properly exit and keep running
+			## in the background, using up 100% CPU.
+			if Option.evil
 				Thread.current.priority = PRIORITY
+
 				while true
 					Thread.stop
 					manage unless @scheduled.empty? or !@active
@@ -40,10 +47,8 @@ module Scheduler
 		dir.scheduled = true
 		unless @scheduled.include? dir
 			@scheduled << dir
-			if EVIL
-				@thread.run
-			end
 		end
+		@thread.run if Option.evil
 	end
 
 	private