Erlang/OTP Forums

Author Message

<  Erlang  ~  A stupid question about exiting

klm
Posted: Tue May 26, 2009 5:42 pm Reply with quote
User Joined: 11 May 2009 Posts: 18
Hello !

I've got a question, it can seems stupid to you but it's really a problem for me.

What's the function, how to, quit a program ? Smile

and if I have 2 or more process in my program how can I stop all the program ?

thanks for your responses
View user's profile Send private message
Mazen
Posted: Thu May 28, 2009 6:02 pm Reply with quote
User Joined: 20 Jul 2006 Posts: 164 Location: London
Please define "the program"...

if you by "the program" mean the virtual machine then try:

init:stop/1 <- Graceful
erlang:halt/0 <- Kill it
q/0 <- Graceful (from shell only)

In order to shutdown everything properly you should learn about how to create applications (http://www.erlang.org/doc/design_principles/applications.html#7) then you should learn about releases (http://www.erlang.org/doc/design_principles/release_structure.html#10) then you can read about how to stop and start releases properly using OTP.

If you don't want all this then you can just make 1 process which starts other processes and then send them all a message when you call mymodule:stop().

/Mazen
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

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