Re: Patch Package OTP 24.0.6 Released

Max Lapshin <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAMxVRxCQ1htSOHVwAeeDM+SQnbfhes_mJQFnd=pdOwjFnES1yw@mail.gmail.com>
It is very easy:


call(Process, CallArgs) ->
   case process_info(Process, message_queue_len) of
     {message_queue_len, Len} when Len < 1000 ->
         gen_server:call(Process, CallArgs, 20000);
     {message_queue_len, _} ->
         {error, overloaded};
     _ ->
         {error, noproc}
 end.


This is not a production code and it can ruin performance on a
multicore machine if many threads are trying to read
message_queue_len.
But somewhere we use something like this.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.