コード例 #1
0
 // 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 !);
コード例 #2
0
 // 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);
     });
 }
コード例 #3
0
                // 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[..]);
コード例 #4
0
ファイル: testenv_windows.cs プロジェクト: zjmit/go2cs
            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, "");
            }
コード例 #5
0
                    // 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);
                    }
コード例 #6
0
 private static void buildSlicing8TablesOnce()
 {
     slicing8TablesBuildOnce.Do(buildSlicing8Tables);
 }
コード例 #7
0
 private static ptr <CertPool> systemRootsPool()
 {
     once.Do(initSystemRoots);
     return(_addr_systemRoots !);
 }
コード例 #8
0
 // StartSigHandlers starts the signal handlers.
 public static void StartSigHandlers()
 {
     onceProcessSignals.Do(processSignals);
 }
コード例 #9
0
ファイル: conf.cs プロジェクト: zjmit/go2cs
 // systemConf returns the machine's network configuration.
 private static ptr <conf> systemConf()
 {
     confOnce.Do(initConfVal);
     return(_addr_confVal !);
 }