summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2022-05-17 13:37:26 +0800
committerGitHub <noreply@github.com>2022-05-17 07:37:26 +0200
commit33888a73840a7f9fa46f79e613d488de2d193916 (patch)
tree67549e1d6441771ca6ea970523deebf7c962f059
parent19001c070bbe7645ff45fcbd66ab221235715302 (diff)
downloadNim-33888a73840a7f9fa46f79e613d488de2d193916.tar.gz
[manual] TLock => Lock (#19785)
* [manual] TLock => Lock

* minor
-rw-r--r--doc/manual.rst10
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/manual.rst b/doc/manual.rst
index 126b0f0d6..bfcb41b7a 100644
--- a/doc/manual.rst
+++ b/doc/manual.rst
@@ -8112,7 +8112,9 @@ Object fields and global variables can be annotated via a `guard` pragma:
 
 .. code-block:: nim
 
-  var glock: TLock
+  import std/locks
+
+  var glock: Lock
   var gdata {.guard: glock.}: int
 
 The compiler then ensures that every access of `gdata` is within a `locks`
@@ -8139,7 +8141,7 @@ that also implement some form of locking at runtime:
 
 .. code-block:: nim
 
-  template lock(a: TLock; body: untyped) =
+  template lock(a: Lock; body: untyped) =
     pthread_mutex_lock(a)
     {.locks: [a].}:
       try:
@@ -8181,10 +8183,12 @@ the expressivity of the language:
 
 .. code-block:: nim
 
+  import std/locks
+
   type
     ProtectedCounter = object
       v {.guard: L.}: int
-      L: TLock
+      L: Lock
 
   proc incCounters(counters: var openArray[ProtectedCounter]) =
     for i in 0..counters.high: