class Async::Task

def run(*arguments)

@raises [RuntimeError] If the task is already running.

Begin the execution of the task.
def run(*arguments)
	if @status == :initialized
		@status = :running
		
		schedule do
			@block.call(self, *arguments)
		rescue => error
			# I'm not completely happy with this overhead, but the alternative is to not log anything which makes debugging extremely difficult. Maybe we can introduce a debug wrapper which adds extra logging.
			if @finished.nil?
				Console::Event::Failure.for(error).emit(self, "Task may have ended with unhandled exception.", severity: :warn)
			else
				# Console::Event::Failure.for(error).emit(self, severity: :debug)
			end
			
			raise
		end
	else
		raise RuntimeError, "Task already running!"
	end
end