Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 49 for lockOSThread (0.21 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/testprogcgo/lockosthread.go

    		mainThread = C.pthread_self()
    	})
    	register("LockOSThreadMain", LockOSThreadMain)
    
    	registerInit("LockOSThreadAlt", func() {
    		// Lock the OS thread now so main runs on the main thread.
    		runtime.LockOSThread()
    	})
    	register("LockOSThreadAlt", LockOSThreadAlt)
    }
    
    func LockOSThreadMain() {
    	// This requires GOMAXPROCS=1 from the beginning to reliably
    	// start a goroutine on the main thread.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 02 20:21:33 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  3. 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)
  4. src/cmd/cgo/internal/testsanitizers/testdata/tsan.go

    int getVal() {
    	return val;
    }
    
    void setVal(int i) {
    	val = i;
    }
    */
    import "C"
    
    import (
    	"runtime"
    )
    
    func main() {
    	runtime.LockOSThread()
    	C.setVal(1)
    	c := make(chan bool)
    	go func() {
    		runtime.LockOSThread()
    		C.setVal(2)
    		c <- true
    	}()
    	<-c
    	if v := C.getVal(); v != 2 {
    		panic(v)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 700 bytes
    - Viewed (0)
  5. src/cmd/cgo/internal/testsanitizers/testdata/tsan2.go

    }
    
    void setVal(int) __attribute__ ((weak));
    
    void setVal(int i) {
    	val = i;
    }
    */
    import "C"
    
    import "runtime"
    
    //export GoRun
    func GoRun() {
    	runtime.LockOSThread()
    	c := make(chan bool)
    	go func() {
    		runtime.LockOSThread()
    		C.setVal(2)
    		c <- true
    	}()
    	<-c
    }
    
    func main() {
    	if v := C.run(); v != 2 {
    		panic(v)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 940 bytes
    - Viewed (0)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top