Erlang (programming language): I'm really confused at openpoker gateway's method tcp_server: socket_loop/5. Just as the author say, "Don't mess with the following code unless you really know what you're doing.". Who can give it a explaination, what's the diff with {'Exit', New, _Why} and {'Exit', Pi
-
-
Answer:
He kills the child process with exit(oops) when gen_tcp:accept fails, i.e. I guess in this case _Why will be equal oops. Anyway this is very old style of Erlang network programming, if you writing a new code, just use Ranch library written by the author of Cowboy web server.
Zvi Avraham at Quora Visit the source
Other answers
Thanks for all, I have added piece of key code at comment. Erlang's mailbox service is asynchronous. The master process socket_loop/5 receives all the message from child processes. When one of child processes finish its work, it will exit normal and be catched by the master process because code_start/5 's process_flag(trap_exit, true), so I have idea about {'EXIT', Pid, _Why}, and I even think _Why most time here would be normal, however we doesn't care about that. I'm confused about {'EXIT', New, _Why}, does it mean a new child process exit abnormal when it try to accept client's request?
Smart Lee
Related Q & A:
- Feeling sick, but I don't know what it's from?Best solution by Yahoo! Answers
- Does anyone know where I can download yu-gi-oh online games that don't need real money to play?Best solution by Yahoo! Answers
- Is there any way I can get my MSN password back if I don't know the secret question that it asks?Best solution by Yahoo! Answers
- What is a post car ? I see that on a muscle car ad and I just don't get it?Best solution by Yahoo! Answers
- How do I find a certain tv channel if I don't know what number it is?Best solution by timewarnercable.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.