[erlang-questions] OTP starter question

Bob Cowdery Bob.Cowdery@REDACTED
Mon Dec 4 14:40:06 CET 2006


Hi all

I am trying to get started with OTP. I'm not sure I want to go the whole way at the moment but some features are very useful. So far I have created my callback module and a resource file. I can load and start the app but am having trouble with closing it.

The app consists of several C Nodes and one Erlang node at present. I know I probably should be using some of the distributed OTP stuff but one step at a time. The resource file looks like this:

{
	application, sdrnet,
 	[
 		{description, "ERLINK-SR"},
 		{vsn, "1.0"},
 		{mod, {sdrnet,[]}},
  		{env, 	
  			[	
  				{nodes, [sm, dsp, stream, ui]},
  				{bin, "D:\\srs\\vs\\srs\\debug\\"},
  				{sm, "erlink-sm -n sm -h LT-VAIO-100 -c sm -s switcher@REDACTED -u ui -t stream -d dsp -p D:\\srs\\state"},
  				{dsp, "erlink-dspwin -n dsp -h LT-VAIO-100 -c dsp -s switcher@REDACTED"},
  				{stream, "erlink-streams -n stream -h LT-VAIO-100 -c stream -s switcher@REDACTED"},
  				{hw, ""},
  				{ui, "erlink-gtkmain -n ui -h LT-VAIO-100 -c ui -s switcher@REDACTED -m sm"}
  			]
  		}
 	]
 }.

In my application node (start/2) I start up my main supervisor and send it a message to start the full application. This loops through and starts all the C Nodes in the nodes list above using the parameters to spawn each executable. Apart from the fact I need to get some feedback to know when they are properly initialised (this should be easy, just haven't done it yet)this works fine and my application comes up and works fine. My intension was that on application:close() I would message the supervisor to close all the nodes (which need to go through a proper close down procedure). However, it seems that application:close() is only called after the application is closed because my supervisor seems to have gone awol by then so nothing gets closed.

My goal at the moment is to have one click/command startup/shutdown and be able to create different configurations through the resource file, (like profiles) selecting the right one at start-up. I am not interested right now in monitoring/fail-over/re-route etc. I feel it's nearly doing what I want but I can't sidestep using application:stop/1 as it takes the Pid of the supervisor process being returned from start/2 to send the message to ,which I don't otherwise have. Is there a quick route forward here or do I have to buy into the whole OTP thing.

Thanks
Bob

------------------------------
Smartlogic
Bob Cowdery
Technical Consultant
 
Tel:      +44(0) 1223 271026
Fax:     +44(0) 1223 271010
mailto:  bob.cowdery@REDACTED
map:     http://www.smartlogic.com/maps_to_office.html
web:     www.smartlogic.com
*******************************************************
This e-mail may contain proprietary and confidential information and 
is intended for the recipient(s) only. If an addressing or transmission 
error has misdirected this e-mail, please notify the systems administrator
by forwarding this e-mail to postmaster@REDACTED If you are
not the intended recipient(s) - disclosure, distribution, copying or 
printing of this e-mail is strictly prohibited.
********************************************************






More information about the erlang-questions mailing list