执行时receive
,BEAM VM扫描邮箱以查找第一个合适的(匹配)消息,如果找不到,则阻止该过程。
诀窍是,由于新引用在创建之前就不可能存在于邮箱中,因此receive {Reference, Term}
,仅当Reference
创建时才需要扫描整个邮箱。
这就是以下短语的含义:
The compiler recognizes code that uses a newly created reference (ref) in a receive (see [ref_trick_code]), and emits code to avoid the long inbox scan since the new ref can not already be in the inbox.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句