diff options
author | hut <hut@lavabit.com> | 2009-07-19 23:21:48 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-07-19 23:21:48 +0200 |
commit | 0a0c06e37f8a236cf780ee822357e5c59e197d5c (patch) | |
tree | 4b3548d24a186440e137b621226e217c44c1eea1 | |
parent | b1040ca5c9b4d630b99d54d5f9b63c3bafd5a7a3 (diff) | |
download | ranger-0a0c06e37f8a236cf780ee822357e5c59e197d5c.tar.gz |
replaced EVIL with Option.evil, moved explanation to scheduler.rb
-rw-r--r-- | code/scheduler.rb | 13 | ||||
-rwxr-xr-x | ranger.rb | 6 |
2 files changed, 10 insertions, 9 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 diff --git a/ranger.rb b/ranger.rb index 3dc05e6d..485305e8 100755 --- a/ranger.rb +++ b/ranger.rb @@ -4,11 +4,6 @@ version = '0.2.4' require 'pathname' $: << MYDIR = File.dirname(Pathname(__FILE__).realpath) -## this switches on some features which may cause harm, -## mainly by leaving this program running after you quit it from -## your window manager, ie. clicking on the X or pressing ALT+F4 -EVIL = false - if ARGV.size > 0 case ARGV.first when '-k' @@ -50,6 +45,7 @@ opt = { :debug_file => '/tmp/errorlog', :colorscheme => 'default', :cd => ARGV.include?('--cd'), + :evil => false } class OptionClass < Struct.new(*opt.keys) |