lib/plezi/base/engine.rb in plezi-0.7.5 vs lib/plezi/base/engine.rb in plezi-0.7.6
- old
+ new
@@ -7,30 +7,14 @@
def max_threads
@max_threads ||= 16
end
# Plezi event cycle settings: sets how many worker threads Plezi will run.
def max_threads= value
- @max_threads = value
+ raise "Plezi will hang and do nothing if there isn't at least one (1) working thread. Cannot set Plezi.max_threads = #{value}" if value.to_i <= 0
+ @max_threads = value.to_i
end
- # Plezi event cycle settings: how long to wait for IO activity before forcing another cycle.
- #
- # No timing methods will be called during this interval.
- #
- # get the current idle setting
- def idle_sleep
- @idle_sleep ||= 0.1
- end
- # Plezi event cycle settings: how long to wait for IO activity before forcing another cycle.
- #
- # No timing methods will be called during this interval.
- #
- # set the current idle setting
- def idle_sleep= value
- @idle_sleep = value
- end
-
# Plezi Engine, DO NOT CALL. creates the thread pool and starts cycling through the events.
def start_services
# prepare threads
exit_flag = false
threads = []
@@ -43,11 +27,11 @@
# Thread.new { check_connections until SERVICES.empty? }
#...
# set signal tarps
trap('INT'){ exit_flag = true; raise "close Plezi" }
trap('TERM'){ exit_flag = true; raise "close Plezi" }
- puts 'Services running. Press ^C to stop'
+ puts "Services running Plezi version #{Plezi::VERSION}. Press ^C to stop"
# sleep until trap raises exception (cycling might cause the main thread to ignor signals and lose attention)
(sleep unless SERVICES.empty?) rescue true
# start shutdown.
exit_flag = true
# set new tarps
@@ -77,10 +61,10 @@
def self.thread_cycle flag = 0
io_reactor rescue false # stop_connections
true while fire_event
fire_timers
- rescue Exception => e
-
- error e
+ # rescue Exception => e
+ # error e
+ # # raise if e.is_a?(SignalException) || e.is_a?(SystemExit)
end
end