Fixes an issue identified by egypt when the task's proc returns. This also stores the return value in task.retval
git-svn-id: file:///home/svn/framework3/trunk@8007 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
5938d289f5
commit
a414d5fc8f
|
@ -16,6 +16,7 @@ class TaskManager
|
|||
attr_accessor :proc
|
||||
attr_accessor :source
|
||||
attr_accessor :exception
|
||||
attr_accessor :retval
|
||||
|
||||
#
|
||||
# Create a new task
|
||||
|
@ -36,6 +37,13 @@ class TaskManager
|
|||
etime.to_f - self.created.to_f
|
||||
end
|
||||
|
||||
#
|
||||
# Run the associated proc
|
||||
#
|
||||
def run(*args)
|
||||
self.retval = self.proc.call(*args) if self.proc
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
@ -145,10 +153,10 @@ class TaskManager
|
|||
begin
|
||||
if(task.timeout)
|
||||
::Timeout.timeout(task.timeout) do
|
||||
task.proc.call(self, task)
|
||||
task.run(self, task)
|
||||
end
|
||||
else
|
||||
task.proc.call(self, task)
|
||||
task.run(self, task)
|
||||
end
|
||||
rescue ::Exception => e
|
||||
|
||||
|
|
Loading…
Reference in New Issue