def run(self, callback):
with self._lock:
self._tasks_running += 1
if self._tasks_running == 1:
self._progress_animation = ProgressAnimation(self.tasks_running).start()
def callback_wrapper():
try:
callback()
except Exception as e:
log_exception(
'Background task failed with exception: [{exception}]'.format(
exception=e))
with self._lock:
self._tasks_running -= 1
self.log('tasks running = ' + str(self._tasks_running))
sublime.set_timeout_async(callback_wrapper, 0)
评论列表
文章目录