I have a question about golang preempt schedule,  here is my example code;

I doubt why the bar groutine don't happen preempt schedule? (I build with 
-gcflags “-N -l” to stop func inline)

More if my server with one or two cpu bound worker goroutine runing, when 
the gc need stop the world, how it can stop the worker? 


package main

import “time"


// GOMAXPROCS=1

var sum1 int64


func add1() {

   for i := 0; i < 10000; i++ {

       for j := 0; j < 10000; j++ {

           sum1++

       }

   }

}


func bar() {

   for {

       add1()

   }

}


func main() {


    go bar()


    time.Sleep(1*time.Second)


    println("debug>>>")

}


-- 
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