additionally, threads (m's) currently locked to goroutines using 
runtime.LockOSThread don't count either. 

On Tuesday, June 21, 2022 at 2:38:04 AM UTC+2 se...@liao.dev wrote:

> 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 <jprrahu...@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...@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/de054b33-221c-4983-8c00-5dc1744beb51n%40googlegroups.com.

Reply via email to