|
|
| Author |
Message |
< Erlang ~ starting a process |
| phicarre |
Posted: Fri Mar 27, 2009 4:44 pm |
|
|
|
User
Joined: 23 Mar 2009
Posts: 14
|
which is the difference between the following instructions ?
spawn(?module,process(arguments))
spawn(?module,process,[arguments])
The second one gives me a compilation error: process is unused and a run-time error: error in process P on node N with exit value: {undef,[{module,process,[...]}]} |
Last edited by phicarre on Fri Mar 27, 2009 5:17 pm; edited 1 time in total |
|
| Back to top |
|
| keymone |
Posted: Fri Mar 27, 2009 4:56 pm |
|
|
|
User
Joined: 17 Sep 2007
Posts: 11
Location: Lviv, Ukraine
|
spawn(?MODULE, process(Arguments)) - this is wrong, you probably want to do this:
spawn(?MODULE, process, [Arguments]) - this is correct spawn call but you need to export process function:
-export([process/number_of_arguments]).
the error you get is actually a warning and it means you defined process function but never exported it. |
|
|
| Back to top |
|
| phicarre |
Posted: Fri Mar 27, 2009 10:45 pm |
|
|
|
User
Joined: 23 Mar 2009
Posts: 14
|
|
| Back to top |
|
| keymone |
Posted: Mon Mar 30, 2009 6:32 am |
|
|
|
User
Joined: 17 Sep 2007
Posts: 11
Location: Lviv, Ukraine
|
there is only 1 definition of spawn/2 described in documentation: http://www.erlang.org/doc/man/erlang.html#spawn-2
spawn(Node, Fun) -> pid()
in your case it means
?MODULE should return correct Node name and
process(Arguments) should return a fun
otherwise you'll run into runtime error
if it does runs you should provide some code because i have no idea how should it look like to make that spawn/2 work correctly |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|