简体   繁体   English

Elixir GenEvent的handle_call和handle_event有什么区别?

[英]What are the differences between Elixir GenEvent's handle_call and handle_event?

Please look at my answer below for the differences that I found and let me know if they are wrong or if there are more differences. 请查看以下我的答案,以查找所发现的差异,并让我知道它们是否错误或是否还有更多差异。 Thank you. 谢谢。

The difference that I saw on Elixir's documentation 我在Elixir的文档中看到的差异

  • handle_call must return a reply and handle_event does not have to return a reply handle_call必须返回答复,而handle_event不必返回答复

It seems to me that event is used to change the state and call is used to get the state. 在我看来, event用于更改状态,而call用于获取状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM