[erlang-questions] spawn_monitor documentation wrong

Ulf Wiger (TN/EAB) <>
Thu Aug 23 19:32:19 CEST 2007


 

> -----Original Message-----
> From:  
> [mailto:] On Behalf Of Gabriel Pack
> Sent: den 23 augusti 2007 18:44
> To: 
> Subject: [erlang-questions] spawn_monitor documentation wrong
> 
> Is the man page for erlang:spawn_monitor/1 out of date? I'm 
> running R11B-5.
> 
> I had to find out the hard way that it doesn't behave like spawn_link/
> 1 as claimed. Rather than returning a PID, it returns {PID, 
> _}. When trapping exits, you have to receive {'DOWN', _, _, 
> _, _} as opposed to {'EXIT', _, _}.
> 
> I've been coding in Erlang for all of a couple weeks now. So 
> let me know if I'm missing something.

The doc doesn't claim that spawn_monitor/1 works like spawn_link/1.
It says that it works like spawn/1, with the exception that it 
also creates a monitor.

>From http://www.erlang.org/doc/man/erlang.html

"erlang:spawn_monitor(Fun) -> {pid(),reference()}

Types:

Fun = fun()

Returns the pid of a new process started by the application of Fun 
to the empty list [] and reference for a monitor created to the new 
process. Otherwise works like spawn/3. "


BR,
Ulf W



More information about the erlang-questions mailing list