Received: by 10.223.117.13 with SMTP id o13mr28127faq.10.1284124142007; Fri, 10 Sep 2010 06:09:02 -0700 (PDT) X-BeenThere: erlang-programming@googlegroups.com Received: by 10.223.32.142 with SMTP id c14ls2027834fad.2.p; Fri, 10 Sep 2010 06:09:01 -0700 (PDT) Received: by 10.223.118.84 with SMTP id u20mr33568faq.8.1284124141192; Fri, 10 Sep 2010 06:09:01 -0700 (PDT) Received: by 10.223.118.84 with SMTP id u20mr33567faq.8.1284124141172; Fri, 10 Sep 2010 06:09:01 -0700 (PDT) Return-Path: Received: from morgoth.cslab.ericsson.net (morgoth.cslab.ericsson.net [193.180.168.22]) by gmr-mx.google.com with SMTP id y11si687102faj.10.2010.09.10.06.09.00; Fri, 10 Sep 2010 06:09:01 -0700 (PDT) Received-SPF: pass (google.com: domain of erlang-questions-return-53273-erlang-programming+garchive-81772=googlegroups....@erlang.org designates 193.180.168.22 as permitted sender) client-ip=193.180.168.22; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of erlang-questions-return-53273-erlang-programming+garchive-81772=googlegroups....@erlang.org designates 193.180.168.22 as permitted sender) smtp.mail=erlang-questions-return-53273-erlang-programming+garchive-81772=googlegroups....@erlang.org Received: (qmail 16559 invoked by alias); 10 Sep 2010 13:08:22 -0000 Mailing-List: contact erlang-questions-h...@erlang.org; run by ezmlm Sender: Precedence: bulk List-Id: Erlang/OTP discussions List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Delivered-To: mailing list erlang-questi...@erlang.org Received: (qmail 31820 invoked from network); 10 Sep 2010 13:08:22 -0000 X-Virus-Scanned: amavisd-new at rabbitmq.com Date: Fri, 10 Sep 2010 14:07:58 +0100 From: Matthew Sackman To: erlang-questi...@erlang.org Message-ID: <20100910130757.GA25...@rabbitmq.com> Mail-Followup-To: erlang-questi...@erlang.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Subject: [erlang-questions] From whence do monitors come? gen.erl has the following code in do_call: catch erlang:send(Process, {Label, {self(), Mref}, Request}, [noconnect]), receive {Mref, Reply} -> erlang:demonitor(Mref, [flush]), {ok, Reply}; {'DOWN', Mref, _, _, noconnection} -> exit({nodedown, Node}); {'DOWN', Mref, _, _, Reason} -> exit(Reason) If the callee is something like a gen_server, and on handling that msg returns a {stop, Reply, Reason, State} quple, there seems to be a race between the reply and the monitor. Or more simply, say the callee does something like: receive {'$gen_call', From, _Msg} -> gen_server:reply(From, done) end. There seems to be a race - what's stopping the DOWN from the monitor overtaking the reply from the callee? The only thing that I can think of is that the DOWN is considered to come *from* the callee. Is that right? Matthew ________________________________________________________________ erlang-questions (at) erlang.org mailing list. See http://www.erlang.org/faq.html To unsubscribe; mailto:erlang-questions-unsubscr...@erlang.org