[erlang-questions] blocking vs non-blocking gen_tcp:accept()

Matthias Lang matthias@REDACTED
Fri Feb 15 21:45:02 CET 2008


Robin writes:
 > Does gen_tcp:accept() block the entire OS thread or just the calling
 > erlang process?

Just the erlang process. (verifying this yourself is straightforward)

 > "One of the shortcomings of the gen_tcp module is that it only exports
 > interface to a blocking accept call." ->
 > http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles
 > 
 > Does the performance gain of non-blocking accept justify the added
 > complexity (finite state machine etc)?

I think the point the author of the trapexit article wanted to make
was that the accept-blocks-the-calling-erlang-process design in
gen_tcp means that you need an extra erlang process in your code.

Matt



More information about the erlang-questions mailing list