from runtime:

> The GOMAXPROCS variable limits the number of operating system threads
that can execute user-level Go code simultaneously. There is no limit to
the number of threads that can be blocked in system calls on behalf of Go
code; those do not count against the GOMAXPROCS limit.

- sean

On Mon, Jun 20, 2022, 23:26 Rahul Tiwari <jprrahultiw...@gmail.com> wrote:

> I have intentionally set a max limit on the number of threads which can be
> spawned by my Go program to be 1 and the Go runtime errors out that it
> exceeds 1-thread limit.
> I've checked the entire code of runtime but couldn't find how the minimum
> threshold of threads to be spawned is decided. Any pointers?
>
> ```
> *package main*
>
> *import (*
> *"fmt"*
> *"runtime/debug"*
> *)*
>
> *func main() {*
> * debug.SetMaxThreads(1)*
> * fmt.Println("Hello world!")*
> }
> ```
>
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/3c14a0f8-7363-4183-9b0d-781d72e6ef8fn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/3c14a0f8-7363-4183-9b0d-781d72e6ef8fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGabyPrH0hy2xhVp40CNOfQjByW-kPUZjy%3Dk3RPcLTKzQ8Jewg%40mail.gmail.com.

Reply via email to