Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for CheckBindM (0.42 sec)

  1. src/runtime/testdata/testprogcgo/bindm.go

    //go:build !plan9 && !windows
    
    // Test that callbacks from C to Go in the same C-thread always get the same m.
    // Make sure the extra M bind to the C-thread.
    
    package main
    
    /*
    extern void CheckBindM();
    */
    import "C"
    
    import (
    	"fmt"
    	"os"
    	"runtime"
    	"sync"
    	"sync/atomic"
    )
    
    var (
    	mutex      = sync.Mutex{}
    	cThreadToM = map[uintptr]uintptr{}
    	started    = atomic.Uint32{}
    )
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 17 21:53:11 UTC 2023
    - 1.2K bytes
    - Viewed (0)
  2. src/runtime/testdata/testprogcgo/bindm.c

    #define CHECKCALLS 100
    
    static void* checkBindMThread(void* thread) {
    	int i;
    	for (i = 0; i < CHECKCALLS; i++) {
    		GoCheckBindM((uintptr_t)thread);
    		usleep(1);
    	}
    	return NULL;
    }
    
    void CheckBindM() {
    	int i;
    	pthread_t s[CTHREADS];
    
    	for (i = 0; i < CTHREADS; i++) {
    		pthread_create(&s[i], NULL, checkBindMThread, &s[i]);
    	}
    	for (i = 0; i < CTHREADS; i++) {
    		pthread_join(s[i], NULL);
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 17 21:53:11 UTC 2023
    - 692 bytes
    - Viewed (0)
Back to top