码迷,mamicode.com
首页 > 其他好文 > 详细

"[Erl_Question00]:gen_server:reply/2

时间:2014-05-05 13:16:53      阅读:347      评论:0      收藏:0      [点我收藏+]

标签:des   style   width   strong   http   com   


---

genserver:reply/2

reply(Client, Reply) –> Result
     Types:
    Client - see below
    Reply = term()
    Result = term()
This function can be used by a gen

server to explicitly send a reply to a client that called call/2,3 or multicall/2,3,4, when the reply cannot be defined in the return value of Module:handlecall/3.
Client must be the From argument provided to the callback function. Reply is an arbitrary term, which will be given back to the client as the return value of call/2,3 or multicall/2,3,4.
The return value Result is not further defined, and should always be ignored.
bubuko.com,布布扣
Result :

bubuko.com,布布扣
if exchange the timer:sleep(3000) and timer:sleep(1000)  the Result will be "gen

server:reply"
so the from process only receive the fast reply ,but the genserver will execute both!
Why?
gen
server:reply/2 design as :

bubuko.com,布布扣

"[Erl_Question00]:gen_server:reply/2,布布扣,bubuko.com

"[Erl_Question00]:gen_server:reply/2

标签:des   style   width   strong   http   com   

原文地址:http://www.cnblogs.com/zhongwencool/p/3705043.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!