spawn_link(N,M,F,A)

Joe Armstrong joe@REDACTED
Thu Dec 10 10:52:04 CET 1998


> Ok, this might be a rather "stupid" question, but here goes:

	There are no stupid questions - only bad replies

> 
> I've written a simple client/server counter module based on the stuff from the
> book.  I've got two different erl JAM vm's running, one named "a@REDACTED", the
> other "nt@REDACTED" using -sname for both.  nt@REDACTED cannot find my counter
> module due to the fact that its not in the current directory.  a@REDACTED has it
> loaded already from the shell ("c(counter).").
> 
> When i do this from a third shell:
> 
> spearce% erl_call -e -sname a@REDACTED
> P=spawn_link('nt@REDACTED',erlang,apply,[counter,inc,[list_to_pid("<0.43.0>")]]),
> receive
>         Any -> {P,Any}
> end.
> ^D
> 

	Just I quick thought list_to_pid("<0.43.0>") is *very* error
prone. (list_to_pid is a stupid BIF that should be assigned to the "bad
ideas" dustbin.) It will *probably* work if you run on the same node and
have luch otherwise not. 

	pid_to_list(Pid) takes a Pid and produces an external printed
representation of the the Pid. This is mainly intended for debugging 
the inverse operation whould probably be disallowed.

	Much better to register the name of the Pid and use
whereis to find out where it is (or some variation of this)

	/Joe

> the erl_call hangs with no output, and nothing is logged to either process. 
> Shouldn't i be getting an {'EXIT',{undef,{counter,inc,[<0.43.0>]}} message sent
> to the thread handling the erl_call?  Or am i looking at this the wrong way?
> 
> Just seemed rather strange with spawn about how certain errors are handled and
> seem to deadlock a process....
> 
> (btw, nothing else is deadlocked, just this one erl_call.)
> 
> TIA.
> 
> --
> Shawn.
> 
> (The above are the rantings of a body without a mind.)
> 




More information about the erlang-questions mailing list