Exemplo n.º 1
0
 public mark(@string name = default, runtime.MemStats startM = default, runtime.MemStats endM = default, runtime.MemStats gcM = default, time.Time startT = default, time.Time endT = default)
 {
     this.name   = name;
     this.startM = startM;
     this.endM   = endM;
     this.gcM    = gcM;
     this.startT = startT;
     this.endT   = endT;
 }
Exemplo n.º 2
0
        public static void LockOSThreadTemplateThreadRace()
        {
            // This test attempts to reproduce the race described in
            // golang.org/issue/38931. To do so, we must have a stop-the-world
            // (achieved via ReadMemStats) racing with two LockOSThread calls.
            //
            // While this test attempts to line up the timing, it is only expected
            // to fail (and thus hang) around 2% of the time if the race is
            // present.

            // Ensure enough Ps to actually run everything in parallel. Though on
            // <4 core machines, we are still at the whim of the kernel scheduler.
            runtime.GOMAXPROCS(4L);

            go_(() => () =>
            {
                // Stop the world; race with LockOSThread below.
                ref runtime.MemStats m = ref heap(out ptr <runtime.MemStats> _addr_m);
                while (true)
                {
                    runtime.ReadMemStats(_addr_m);
                }
            } ());