[erlang-questions] concurrency question

Mark Bucciarelli mkbucc@REDACTED
Fri Sep 30 03:25:07 CEST 2016


I have a program that does the following:

- start gen_event, naming it "dispatcher"
- spawn a process
- send 60 message to process then a stop message
- exit

The spawned process outputs a line to stdout for
each message recieved, and after 40 or so messages,
the spawned process calls gen_event:notify(dispatcher, ...).

This has the obvious bug that when the event is fired, the
dispatcher is long gone.

When I run this from the command line like this:

    erl -run simulation -run init stop

the spawned process does not print any error message to
the console when it crashes.

But when I run it from inside the interpreter,

    > simulation:start().

I see:

** exception error: no such process or port

(which is gen_event saying hey, I can't notify the Pid with that name

because it's gone.)


Why don't I get that error output when I run from the console?


Thanks!


Mark
-- 
Blogging at markbucciarelli.com
Tweeting @mbucc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160929/a7a7b9e5/attachment.htm>


More information about the erlang-questions mailing list