|
|
| Author |
Message |
< Erlang ~ Concurrency and OTP |
| bnagle |
Posted: Mon Mar 14, 2011 6:59 pm |
|
|
|
Joined: 14 Mar 2011
Posts: 1
|
Hi,
I am relatively new to erlang; I have successfully used it for two projects, and am now working on a third. I am attempting to learn OTP and best practices on how to use it. I have been reading the "Erlang and OTP in Action" book, and it has been helping immensely. However, there are a few things I am still confused on.
Currently, I am attempting to build an OTP application that can accept standard erlang messages with data, and then run processing functions on that data. Because the processing functions may take awhile to finish, I do not want the OTP application to block while the processing is running.
The obvious solution to this, is to start a new process for every incoming message. Can anyone point me in the right direction on this? I am assuming that just calling spawn inside call or cast is not the right way of doing it?
Currently, I have a simple OTP application with a supervisor and a gen_server; I am using simple_one_for_one. The application works as expected; a new child is not being started for each connection, and as a result, subsequent calls to the gen_server have to wait for previous ones to finish.
What is the best way to spawn the children in this situation? Also, how can you send new messages only to the most recently created gen_server? hd(supervisor:which_children)?
Thanks |
|
|
| Back to top |
|
| Mazen |
Posted: Tue Mar 15, 2011 8:14 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 164
Location: London
|
Spawn a new process in handle_call and send the "From" argument along with it then return noreply in your handle call, when your process is done have it call gen_server:reply
trap exits in your gen_server and prepare to catch exit signals from the processes you spawned. |
|
|
| Back to top |
|
| dongdongwu |
Posted: Thu Sep 20, 2012 6:07 am |
|
|
|
User
Joined: 19 Sep 2012
Posts: 236
|
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word. |
|
|
| 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
|
|
|