• [Erlang00]:gen_server:reply/2



    ---

    gen_server: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 multi_call/2,3,4, when the reply cannot be defined in the return value of Module:handle_call/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 multi_call/2,3,4.
    The return value Result is not further defined, and should always be ignored.

    Result :


    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 gen_server will execute both!
    Why?
    gen_server:reply/2 design as :

  • 相关阅读:
    设计模式基础:类及类关系的UML表示
    SQL 经典语句
    网络存储
    jstack Dump
    Windows上模拟Linux环境的软件Cygwin
    竞争条件
    Java volatile关键字
    java原子操作
    java死锁小例子
    死锁四个必要条件
  • 原文地址:https://www.cnblogs.com/zhongwencool/p/3705043.html
Copyright © 2020-2023  润新知