调度事件会中断函数吗? [英] Does dispatching an event interrupt a function?

查看:27
本文介绍了调度事件会中断函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设函数 foo() 正在执行.假设发生了一个外部事件,您有一个处理程序.函数 foo() 会被中断以便执行事件处理程序吗?这种情况下的执行顺序是什么?

Let's say function foo() is executing. Suppose that an external event occurs, for which you have a handler. Will function foo() be interrupted so that the event handler can be executed? What is the order of execution in this situation?

推荐答案

不会,foo() 不会被中断.

Flex 是单线程的,所以 foo() 将继续运行.一旦 foo() 完成并且控制权返回到事件循环,则将处理事件队列中的第一个事件.

Flex is single-threaded, so foo() will continue running. Once foo() finishes and control is returned to the event loop, then the first event in the event queue will be processed.

这篇关于调度事件会中断函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆