// MakeTable returns a Table constructed from the specified polynomial. // The contents of this Table must not be modified. public static ptr <Table> MakeTable(uint poly) { if (poly == IEEE) { ieeeOnce.Do(ieeeInit); } return(_addr_IEEETable !);
// analyzeGoroutines generates statistics about execution of all goroutines and stores them in gs. private static void analyzeGoroutines(slice <ptr <trace.Event> > events) { gsInit.Do(() => { gs = trace.GoroutineStats(events); }); }
// MaybeReadByte reads a single byte from r with ~50% probability. This is used // to ensure that callers do not depend on non-guaranteed behaviour, e.g. // assuming that rsa.GenerateKey is deterministic w.r.t. a given random stream. // // This does not affect tests that pass a stream of fixed bytes as the random // source (e.g. a zeroReader). public static void MaybeReadByte(io.Reader r) { closedChanOnce.Do(() => { closedChan = make_channel <object>(); close(closedChan); }); return; array <byte> buf = new array <byte>(1L); r.Read(buf[..]);
private static (bool, @string) hasSymlink() { bool ok = default; @string reason = default; symlinkOnce.Do(initWinHasSymlink); if (winSymlinkErr == null) { return(true, ""); } else if (winSymlinkErr == syscall.EWINDOWS) { return(false, ": symlinks are not supported on your version of Windows"); } else if (winSymlinkErr == syscall.ERROR_PRIVILEGE_NOT_HELD) { return(false, ": you don't have enough privileges to create symlinks"); } return(false, ""); }
// DefaultDir returns the effective GOCACHE setting. // It returns "off" if the cache is disabled. public static @string DefaultDir() { // Save the result of the first call to DefaultDir for later use in // initDefaultCache. cmd/go/main.go explicitly sets GOCACHE so that // subprocesses will inherit it, but that means initDefaultCache can't // otherwise distinguish between an explicit "off" and a UserCacheDir error. defaultDirOnce.Do(() => { defaultDir = cfg.Getenv("GOCACHE"); if (filepath.IsAbs(defaultDir) || defaultDir == "off") { return; } if (defaultDir != "") { defaultDir = "off"; defaultDirErr = fmt.Errorf("GOCACHE is not an absolute path"); return; } // Compute default location. var(dir, err) = os.UserCacheDir(); if (err != null) { defaultDir = "off"; defaultDirErr = fmt.Errorf("GOCACHE is not defined and %v", err); return; } defaultDir = filepath.Join(dir, "go-build"); }); return(defaultDir); }
private static void buildSlicing8TablesOnce() { slicing8TablesBuildOnce.Do(buildSlicing8Tables); }
private static ptr <CertPool> systemRootsPool() { once.Do(initSystemRoots); return(_addr_systemRoots !); }
// StartSigHandlers starts the signal handlers. public static void StartSigHandlers() { onceProcessSignals.Do(processSignals); }
// systemConf returns the machine's network configuration. private static ptr <conf> systemConf() { confOnce.Do(initConfVal); return(_addr_confVal !); }