Tcl package Thread source code

Artifact [62a6b44eec]
Login

Artifact 62a6b44eec5ba1c487c77e89eafbdc3462bea463:

Attachment "thread-doc.diff" to ticket [3fe61dda61] added by bovine 2016-11-12 04:22:18.
diff --git a/doc/thread.man b/doc/thread.man
index fa1aaa5..2dfadfb 100644
--- a/doc/thread.man
+++ b/doc/thread.man
@@ -10,7 +10,7 @@ The [package thread] extension creates threads that contain Tcl
 interpreters, and it lets you send scripts to those threads for
 evaluation.
 
-Additionaly, it provides script-level access to basic thread
+Additionally, it provides script-level access to basic thread
 synchronization primitives, like mutexes and condition variables.
 
 [section COMMANDS]
@@ -61,7 +61,7 @@ and if its internal reference count drops to zero, the thread is
 marked for exit. This kicks the thread out of the event loop
 servicing and the thread continues to execute commands passed in
 the [option script] argument, following the [cmd thread::wait]
-command. If this was the last command in the script, as usualy the
+command. If this was the last command in the script, as usually the
 case, the thread will exit.
 
 [para]
@@ -96,7 +96,7 @@ i.e. it is unreserved. This counter gets incremented by a call to
 [cmd thread::preserve] and decremented by a call to [cmd thread::release]
 command. These two commands implement simple but effective thread
 reservation system and offer predictable and controllable thread
-termination capabilities. It is however possible to create initialy
+termination capabilities. It is however possible to create initially
 preserved threads by using flag [option -preserved] of the
 [cmd thread::create] command. Threads created with this flag have the
 initial value of the reference counter of 1 (one), and are thus
@@ -189,7 +189,7 @@ message string; otherwise, a default error message string will be used.
 Use of this command is deprecated in favour of more advanced thread
 reservation system implemented with [cmd thread::preserve] and
 [cmd thread::release] commands. Support for [cmd thread::unwind]
-command will dissapear in some future major release of the extension.
+command will disappear in some future major release of the extension.
 [para]
 This command stops a prior [cmd thread::wait] command. Execution of
 the script passed to newly created thread will continue from the
@@ -204,13 +204,13 @@ situations.
 Use of this command is deprecated in favour of more advanced thread
 reservation system implemented with [cmd thread::preserve] and
 [cmd thread::release] commands. Support for [cmd thread::exit]
-command will dissapear in some future major release of the extension.
+command will disappear in some future major release of the extension.
 [para]
 This command forces a thread stuck in the [cmd thread::wait] command to
-unconditionaly exit. The thread's exit status defaults to 666 and can be
+unconditionally exit. The thread's exit status defaults to 666 and can be
 specified using the optional [arg status] argument. The execution of
 [cmd thread::exit] command is guaranteed to leave the program memory in the
-unconsistent state, produce memory leaks and otherwise affect other subsytem(s)
+inconsistent state, produce memory leaks and otherwise affect other subsystem(s)
 of the Tcl application in an unpredictable manner. The command returns empty
 result but may trigger Tcl error with the message "target thread died" in some
 situations.
@@ -245,7 +245,7 @@ command, like [cmd update], [cmd vwait], etc.
 
 Optional [option varname] specifies name of the variable to store
 the result of the [arg script]. Without the [option -async] flag,
-the command returns the evaluation code, similarily to the standard
+the command returns the evaluation code, similarly to the standard
 Tcl [cmd catch] command. If, however, the [option -async] flag is
 specified, the command returns immediately and caller can later
 [cmd vwait] on [opt varname] to get the result of the passed [arg script]
@@ -394,7 +394,7 @@ Restrictions: same as for transferring shared channels with the
 This attaches the previously detached [arg channel] in the
 current thread/interpreter. For already existing channels,
 the command does nothing, i.e. it is not an error to attach the
-same channel more than once. The first operation will actualy
+same channel more than once. The first operation will actually
 perform the operation, while all subsequent operation will just
 do nothing. Command throws error if the [arg channel] cannot be
 found in the list of detached channels and/or in the current
@@ -457,7 +457,7 @@ Attempt to unlock the already unlocked mutex will throw Tcl error.
 This command creates many-readers/single-writer mutexes. Reader/writer
 mutexes allow you to serialize access to a shared resource more optimally.
 In situations where a shared resource gets mostly read and seldom modified,
-you might gain some performace by using reader/writer mutexes instead of
+you might gain some performance by using reader/writer mutexes instead of
 exclusive or recursive mutexes.
 [para]
 For reading the resource, thread should obtain a read lock on the resource.
@@ -512,8 +512,8 @@ This command provides script-level access to condition variables.
 A condition variable creates a safe environment for the program
 to test some condition, sleep on it when false and be awakened
 when it might have become true. A condition variable is always
-used in the conjuction with an exclusive mutex. If you attempt
-to use other type of mutex in conjuction with the condition
+used in the conjunction with an exclusive mutex. If you attempt
+to use other type of mutex in conjunction with the condition
 variable, a Tcl error will be thrown.
 
 [para]
diff --git a/doc/tpool.man b/doc/tpool.man
index 51d65d1..81122e2 100644
--- a/doc/tpool.man
+++ b/doc/tpool.man
@@ -34,7 +34,7 @@ During threadpool creation, the implementation will create somany
 worker threads upfront and will keep at least number of them alive
 during the lifetime of the threadpool instance.
 Default value of this parameter is 0 (zero). which means that a newly
-threadpool will have no worker threads initialy. All worker threads
+threadpool will have no worker threads initially. All worker threads
 will be started on demand by callers running [cmd tpool::post] command
 and posting jobs to the job queue.
 
@@ -79,7 +79,7 @@ Default value for this option is unspecified, hence, the Tcl interpreter of
 the worker thread will contain just the initial set of Tcl commands.
 
 [opt_def -exitcmd [arg script]]
-Sets a Tcl script run when the idle worker thread exits. This is normaly
+Sets a Tcl script run when the idle worker thread exits. This is normally
 used to cleanup the state of the worker thread, release reserved resources,
 cleanup memory and such.
 Default value for this option is unspecified, thus no Tcl script will run
diff --git a/doc/tsv.man b/doc/tsv.man
index 547cc35..f35cda1 100644
--- a/doc/tsv.man
+++ b/doc/tsv.man
@@ -10,7 +10,7 @@ This section describes commands implementing thread shared variables.
 A thread shared variable is very similar to a Tcl array but in
 contrast to a Tcl array it is created in shared memory and can
 be accessed from many threads at the same time. Important feature of
-thread shared variable is that each access to the variable is internaly
+thread shared variable is that each access to the variable is internally
 protected by a mutex so script programmer does not have to take care
 about locking the variable himself.
 [para]
@@ -27,7 +27,7 @@ consumed by the variable.
 [call [cmd tsv::names] [opt pattern]]
 
 Returns names of shared variables matching optional [opt pattern]
-or all known variables if pattern is ommited.
+or all known variables if pattern is omitted.
 
 [call [cmd tsv::object] [arg varname] [arg element]]
 
@@ -48,7 +48,7 @@ deleted when the element which this command is pointing to is unset.
 
 Sets the value of the [arg element] in the shared variable [arg varname]
 to [arg value] and returns the value to caller. The [arg value]
-may be ommited, in which case the command will return the current
+may be omitted, in which case the command will return the current
 value of the element. If the element cannot be found, error is triggered.
 
 [call [cmd tsv::get] [arg varname] [arg element] [opt namedvar]]
@@ -57,7 +57,7 @@ Retrieves the value of the [arg element] from the shared variable [arg varname].
 If the optional argument [arg namedvar] is given, the value is
 stored in the named variable. Return value of the command depends
 of the existence of the optional argument [arg namedvar].
-If the argument is ommited and the requested element cannot be found
+If the argument is omitted and the requested element cannot be found
 in the shared array, the command triggers error. If, however, the
 optional argument is given on the command line, the command returns
 true (1) if the element is found or false (0) if the element is not found.
@@ -69,7 +69,7 @@ If the optional element is not given, it deletes the variable.
 
 [call [cmd tsv::exists] [arg varname] [arg element]]
 
-Checks wether the [arg element] exists in the shared variable [arg varname]
+Checks whether the [arg element] exists in the shared variable [arg varname]
 and returns true (1) if it does or false (0) if it doesn't.
 
 [call [cmd tsv::pop] [arg varname] [arg element]]
@@ -86,7 +86,7 @@ sequence of operations but all in one atomic step.
 [call [cmd tsv::incr] [arg varname] [arg element] [opt count]]
 
 Similar to standard Tcl [cmd incr] command but increments the value
-of the [arg element] in shared variaboe [arg varname] instead of
+of the [arg element] in shared variable [arg varname] instead of
 the Tcl variable.
 
 [call [cmd tsv::append] [arg varname] [arg element] [arg value] [opt {value ...}]]
@@ -185,7 +185,7 @@ no value to the caller.
 
 [call [cmd tsv::lpush] [arg varname] [arg element] [opt index]]
 
-This command performes the opposite of the [cmd tsv::lpop] command.
+This command performs the opposite of the [cmd tsv::lpop] command.
 As its counterpart, it returns no value to the caller.
 
 [list_end]
@@ -194,7 +194,7 @@ As its counterpart, it returns no value to the caller.
 
 This command supports most of the options of the standard Tcl
 [cmd array] command. In addition to those, it allows binding
-a shared variable to some persisten storage databases. Currently the persistent
+a shared variable to some persistent storage databases. Currently the persistent
 options supported are the famous GNU Gdbm and LMDB. These options have to be
 selected during the package compilation time.
 The implementation provides hooks for defining other persistency layers, if
@@ -297,7 +297,7 @@ setting a variable as a side-effect.
 [call [cmd tsv::keylkeys] [arg varname] [arg keylist] [opt key]]
 Return  the a list of the keys in the keyed list [arg keylist] in the
 shared variable [arg varname]. If [arg key] is specified, then it is
-the name of a key field who's subfield keys are to be retrieved.
+the name of a key field whose subfield keys are to be retrieved.
 
 
 [call [cmd tsv::keylset] [arg varname] [arg keylist] [arg key] [arg value] [opt {key value..}]]
@@ -323,7 +323,7 @@ Due to the internal design of the Tcl core, there is no provision of full
 integration of shared variables within the Tcl syntax, unfortunately. All
 access to shared data must be performed with the supplied package commands.
 Also, variable traces are not supported. But even so, benefits of easy,
-simple and safe shared data manipulation outweights imposed limitations.
+simple and safe shared data manipulation outweighs imposed limitations.
 
 [section CREDITS]
 Thread shared variables are inspired by the nsv interface found in
diff --git a/doc/ttrace.man b/doc/ttrace.man
index 287fe1e..fb955bc 100644
--- a/doc/ttrace.man
+++ b/doc/ttrace.man
@@ -7,7 +7,7 @@
 
 [description]
 This package creates a framework for on-demand replication of the
-interpreter state accross threads in an multithreading application.
+interpreter state across threads in an multithreading application.
 It relies on the mechanics of Tcl command tracing and the Tcl
 [cmd unknown] command and mechanism.
 [para]
@@ -65,7 +65,7 @@ This is the most important user-level command of the package as
 it wraps most of the commands described below. This greatly
 simplifies things, because user need to learn just this (one)
 command in order to effectively use the package. Other commands,
-as desribed below, are included mostly for the sake of completeness.
+as described below, are included mostly for the sake of completeness.
 
 [call [cmd ttrace::enable]]
 
@@ -91,7 +91,7 @@ the most recent trace epoch.
 
 [call [cmd ttrace::getscript]]
 
-Returns a synthetized Tcl script which may be sourced in any interpreter.
+Returns a synthesized Tcl script which may be sourced in any interpreter.
 This script sets the stage for the Tcl [cmd unknown] command so it can
 load traced resources from the in-memory database. Normally, this command
 is automatically invoked by other higher-level commands like
@@ -102,8 +102,8 @@ is automatically invoked by other higher-level commands like
 [section {CALLBACK COMMANDS}]
 A word upfront: the package already includes callbacks for tracing
 following Tcl commands: [cmd proc], [cmd namespace], [cmd variable],
-[cmd load], and [cmd rename]. Additionaly, a set of callbacks for
-tracing resources (object, clasess) for the XOTcl v1.3.8+, an
+[cmd load], and [cmd rename]. Additionally, a set of callbacks for
+tracing resources (object, classes) for the XOTcl v1.3.8+, an
 OO-extension to Tcl, is also provided.
 This gives a solid base for solving most of the real-life needs and
 serves as an example for people wanting to customize the package
@@ -213,7 +213,7 @@ threads/interpreters in the process.
 Immediate benefit of such approach is the much smaller memory footprint
 of the application and much faster thread creation. By not actually
 loading all necessary procedures (and other resources) in every thread
-at the thread initialization time, but by deffering this to the time the
+at the thread initialization time, but by deferring this to the time the
 resource is actually referenced, significant improvements in both
 memory consumption and thread initialization time can be achieved. Some
 tests have shown that memory footprint of an multithreading Tcl application
diff --git a/generic/threadPoolCmd.c b/generic/threadPoolCmd.c
index 4fc3d86..e819b12 100644
--- a/generic/threadPoolCmd.c
+++ b/generic/threadPoolCmd.c
@@ -623,7 +623,7 @@ TpoolCancelObjCmd(dummy, interp, objc, objv)
     TpoolResult *rPtr;
 
     /*
-     * Syntax: tpool::wait tpoolId jobIdList ?listVar?
+     * Syntax: tpool::cancel tpoolId jobIdList ?listVar?
      */
 
     if (objc < 3 || objc > 4) {