Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 34 for lockOSThread (0.24 sec)

  1. src/runtime/testdata/testprog/lockosthread.go

    	registerInit("LockOSThreadAlt", func() {
    		// Lock the OS thread now so main runs on the main thread.
    		runtime.LockOSThread()
    	})
    	register("LockOSThreadAlt", LockOSThreadAlt)
    
    	registerInit("LockOSThreadAvoidsStatePropagation", func() {
    		// Lock the OS thread now so main runs on the main thread.
    		runtime.LockOSThread()
    	})
    	register("LockOSThreadAvoidsStatePropagation", LockOSThreadAvoidsStatePropagation)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 20:00:09 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  2. src/runtime/testdata/testprog/coro.go

    	n := 0
    	next, _ := iter.Pull(i)
    	for {
    		runtime.LockOSThread()
    		n++
    		v, ok := next()
    		if !ok {
    			break
    		}
    		if v != 5 {
    			return fmt.Errorf("bad iterator: wanted value %d, got %d", 5, v)
    		}
    	}
    	for range n {
    		runtime.UnlockOSThread()
    	}
    	return nil
    }
    
    func callerStopLocked(i iter.Seq[int]) error {
    	runtime.LockOSThread()
    	next, stop := iter.Pull(i)
    	v, _ := next()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 19:46:10 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  3. src/runtime/runtime_linux_test.go

    func init() {
    	// Record pid and tid of init thread for use during test.
    	// The call to LockOSThread is just to exercise it;
    	// we can't test that it does anything.
    	// Instead we're testing that the conditions are good
    	// for how it is used in init (must be on main thread).
    	pid, tid = syscall.Getpid(), syscall.Gettid()
    	LockOSThread()
    
    	sysNanosleep = func(d time.Duration) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 21 20:20:01 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  4. src/internal/trace/testdata/testprog/stress.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Tests a many interesting cases (network, syscalls, a little GC, busy goroutines,
    // blocked goroutines, LockOSThread, pipes, and GOMAXPROCS).
    
    //go:build ignore
    
    package main
    
    import (
    	"log"
    	"net"
    	"os"
    	"runtime"
    	"runtime/trace"
    	"sync"
    	"time"
    )
    
    func main() {
    	var wg sync.WaitGroup
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  5. src/runtime/testdata/testprog/crash.go

    	var s *string
    	_ = *s
    	fmt.Print("SHOULD NOT BE HERE")
    }
    
    func testInNewThread(name string) {
    	c := make(chan bool)
    	go func() {
    		runtime.LockOSThread()
    		test(name)
    		c <- true
    	}()
    	<-c
    }
    
    func Crash() {
    	runtime.LockOSThread()
    	test("main")
    	testInNewThread("new-thread")
    	testInNewThread("second-new-thread")
    	test("main-again")
    }
    
    type P string
    
    func (p P) String() string {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 19:10:41 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  6. src/internal/trace/testdata/testprog/stress-start-stop.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Tests a many interesting cases (network, syscalls, a little GC, busy goroutines,
    // blocked goroutines, LockOSThread, pipes, and GOMAXPROCS).
    
    //go:build ignore
    
    package main
    
    import (
    	"bytes"
    	"io"
    	"log"
    	"net"
    	"os"
    	"runtime"
    	"runtime/trace"
    	"sync"
    	"time"
    )
    
    func main() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  7. src/syscall/pwd_plan9.go

    // (locked to OS thread). Otherwise return false.
    func fixwd(paths ...string) bool {
    	for _, path := range paths {
    		if path != "" && path[0] != '/' && path[0] != '#' {
    			runtime.LockOSThread()
    			Fixwd()
    			return true
    		}
    	}
    	return false
    }
    
    // goroutine-specific getwd
    func getwd() (wd string, err error) {
    	fd, err := open(".", O_RDONLY)
    	if err != nil {
    		return "", err
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:03:59 UTC 2024
    - 2.3K bytes
    - Viewed (0)
  8. src/runtime/testdata/testprog/syscall_windows.go

    func StackMemory() {
    	mem1, err := getPagefileUsage()
    	if err != nil {
    		panic(err)
    	}
    	const threadCount = 100
    	var wg sync.WaitGroup
    	for i := 0; i < threadCount; i++ {
    		wg.Add(1)
    		go func() {
    			runtime.LockOSThread()
    			wg.Done()
    			select {}
    		}()
    	}
    	wg.Wait()
    	mem2, err := getPagefileUsage()
    	if err != nil {
    		panic(err)
    	}
    	// assumes that this process creates 1 thread for each
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 23 17:31:31 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  9. src/runtime/testdata/testprogcgo/stack_windows.go

    func StackMemory() {
    	mem1, err := getPagefileUsage()
    	if err != nil {
    		panic(err)
    	}
    	const threadCount = 100
    	var wg sync.WaitGroup
    	for i := 0; i < threadCount; i++ {
    		wg.Add(1)
    		go func() {
    			runtime.LockOSThread()
    			wg.Done()
    			select {}
    		}()
    	}
    	wg.Wait()
    	mem2, err := getPagefileUsage()
    	if err != nil {
    		panic(err)
    	}
    	// assumes that this process creates 1 thread for each
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 23 17:31:31 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  10. src/runtime/debug_test.go

    		if err != nil {
    			t.Fatal(err)
    		}
    		runtime.GOMAXPROCS(ogomaxprocs)
    		debug.SetGCPercent(ogcpercent)
    	}
    }
    
    func debugCallWorker(ready chan<- *runtime.G, stop *uint32, done chan<- error) {
    	runtime.LockOSThread()
    	defer runtime.UnlockOSThread()
    
    	ready <- runtime.Getg()
    
    	x := 2
    	debugCallWorker2(stop, &x)
    	if x != 1 {
    		done <- fmt.Errorf("want x = 2, got %d; register pointer not adjusted?", x)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 15:08:04 UTC 2023
    - 8K bytes
    - Viewed (0)
Back to top