Is there another priority in otp gen_server info, call, cast queue queue?

When writing codes, I ask myself what type of message should I use call, what type of message should I use info?

Below this question, another long-standing doubt arises as to whether there is a difference in priority between the message info, cast, call? Do these 3 message types have the same queue?

+3
source share
2 answers

The priority of messages is the same. A quick search in gen_server.erl and you will find a simple loop that gets all the data.

loop(Parent, Name, State, Mod, hibernate, Debug) ->
    proc_lib:hibernate(?MODULE,wake_hib,[Parent, Name, State, Mod, Debug]);
loop(Parent, Name, State, Mod, Time, Debug) ->
    Msg = receive
          Input ->
            Input
      after Time ->
          timeout
      end,
    decode_msg(Msg, Parent, Name, State, Mod, Time, Debug, false).

About handle_info :

gen_server, - , ( ).

, timeout, tcp, udp, EXIT, sytem info , handle_call handle_cast.

+5

, call cast? info - , call cast.

, call cast, , : " ?". , call, , cast, .

- , Erlang.

+4

All Articles