class EnClient::TaskManager

Public Class Methods

new() click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 1622
def initialize
  @task_queue = TaskQueue.new
end

Public Instance Methods

put(task, high_prio = false) click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 1626
def put(task, high_prio = false)
  if high_prio
    @task_queue.push_to_front task
  else
    @task_queue.push task
  end
end
run() click to toggle source
# File usr/lib/evernote-mode/enclient.rb, line 1634
def run
  Thread.start do
    LOG.debug "start task manager"
    while true
      task = @task_queue.pop
      LOG.debug "exec #{task}"
      begin
        task.exec
      rescue Exception
        message = ErrorUtils.get_message $!
        LOG.error message
        LOG.error $!.backtrace
      end
    end
  end
end