Nothing about using the network requires new goroutine creation. I wouldn't
expect Dial to create new goroutines, except perhaps temporarily during DNS
lookup or something.

On Mon, Jun 20, 2016 at 6:38 PM Manohar Kumar <forwarding...@gmail.com>
wrote:

>
>
> On Monday, June 20, 2016 at 9:31:08 AM UTC-7, Ian Lance Taylor wrote:
>
>> On Sat, Jun 18, 2016 at 10:17 PM, Manohar Kumar <forwar...@gmail.com>
>> wrote:
>> >
>> > Is it possible that a net.ListenTCP or  ListenUDP call can result in
>> new go
>> > routine/OS thread creation ? I guess not all system calls result in a
>> new go
>> > routine (and OS thread if necessary) creation. But ListenTCP & UDP does
>> many
>> > things underneath and its not clear if it can lead to new go routine
>> > creation.
>>
>> ListenTCP and ListenUDP will not create new goroutines or threads.
>> But those calls just create new listeners; you probably meant to ask
>> about the AcceptTCP and ReadFrom/WriteTo methods.  Those methods will
>> not normally create new goroutines.  However, they may block, and that
>> may cause the Go runtime to create a new thread.
>>
>
> Thanks. How about Dial()  ? Since Dial to a TCP destination requires a
> connection to be established I think it can lead to new go routine
> creation. Can that happen for Dial to an UDP destination as well (which
> shouldn't trigger any network transaction)?
>
> This code runs on a root network namespace and some other child network
> namespaces.  Its not a desirable behavior to have new OS created while its
> executing in the child namespaces.
>
> -Manohar.
>
>
>> > I am mainly interested in Linux and have to make these calls in a part
>> of
>> > the code where new OS thread creation isn't desirable. Please note that
>> > changing that aspect of the design itself is not an option for me.
>>
>> The Go runtime is free to create new OS threads at any time.  You can
>> not reasonably use Go under the restrictions you describe.
>>
>> Ian
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to