diff options
author | konsumlamm <44230978+konsumlamm@users.noreply.github.com> | 2021-01-06 20:29:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-06 20:29:22 +0100 |
commit | d34d023da1d7af972366c3af58a144b395964b4c (patch) | |
tree | 288e272bc9e4d021b2681707f31d777c2035b0c3 /lib/pure/concurrency/cpuinfo.nim | |
parent | 025ca660f7fe396ec6794137c29845feaf7ab9a3 (diff) | |
download | Nim-d34d023da1d7af972366c3af58a144b395964b4c.tar.gz |
Minor docs/format changes (cpuinfo, volatile) (#16602)
Diffstat (limited to 'lib/pure/concurrency/cpuinfo.nim')
-rw-r--r-- | lib/pure/concurrency/cpuinfo.nim | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/pure/concurrency/cpuinfo.nim b/lib/pure/concurrency/cpuinfo.nim index 3e5695360..57d13fde3 100644 --- a/lib/pure/concurrency/cpuinfo.nim +++ b/lib/pure/concurrency/cpuinfo.nim @@ -7,7 +7,11 @@ # distribution, for details about the copyright. # -## This module implements procs to determine the number of CPUs / cores. +## This module implements a proc to determine the number of CPUs / cores. + +runnableExamples: + doAssert countProcessors() > 0 + include "system/inclrtl" @@ -15,15 +19,15 @@ when not defined(windows): import posix when defined(freebsd) or defined(macosx): - {.emit:"#include <sys/types.h>".} + {.emit: "#include <sys/types.h>".} when defined(openbsd) or defined(netbsd): - {.emit:"#include <sys/param.h>".} + {.emit: "#include <sys/param.h>".} when defined(macosx) or defined(bsd): # we HAVE to emit param.h before sysctl.h so we cannot use .header here # either. The amount of archaic bullshit in Poonix based OSes is just insane. - {.emit:"#include <sys/sysctl.h>".} + {.emit: "#include <sys/sysctl.h>".} const CTL_HW = 6 HW_AVAILCPU = 25 @@ -47,7 +51,7 @@ when defined(haiku): header: "<OS.h>".} proc countProcessors*(): int {.rtl, extern: "ncpi$1".} = - ## returns the number of the processors/cores the machine has. + ## Returns the number of the processors/cores the machine has. ## Returns 0 if it cannot be detected. when defined(windows): type @@ -95,8 +99,3 @@ proc countProcessors*(): int {.rtl, extern: "ncpi$1".} = else: result = sysconf(SC_NPROCESSORS_ONLN) if result <= 0: result = 0 - - -runnableExamples: - block: - doAssert countProcessors() > 0 |