summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/concurrency/cpuinfo.nim19
-rw-r--r--lib/pure/volatile.nim4
2 files changed, 11 insertions, 12 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
diff --git a/lib/pure/volatile.nim b/lib/pure/volatile.nim
index 208f0fcaa..7fdf40e4b 100644
--- a/lib/pure/volatile.nim
+++ b/lib/pure/volatile.nim
@@ -12,7 +12,7 @@
 
 template volatileLoad*[T](src: ptr T): T =
   ## Generates a volatile load of the value stored in the container `src`.
-  ## Note that this only effects code generation on `C` like backends
+  ## Note that this only effects code generation on `C` like backends.
   when nimvm:
     src[]
   else:
@@ -26,7 +26,7 @@ template volatileLoad*[T](src: ptr T): T =
 template volatileStore*[T](dest: ptr T, val: T) =
   ## Generates a volatile store into the container `dest` of the value
   ## `val`. Note that this only effects code generation on `C` like
-  ## backends
+  ## backends.
   when nimvm:
     dest[] = val
   else: