mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Replace 'master' with 'controller thread' in NSE script docs/comments
This commit is contained in:
@@ -3402,11 +3402,11 @@ end
|
||||
<para>
|
||||
For example, consider the earlier <xref
|
||||
linkend="nse-worker-example"/>. Until all
|
||||
the workers finish, the master thread must sleep. Note that we cannot
|
||||
the workers finish, the controller thread must sleep. Note that we cannot
|
||||
<literal>poll</literal> for results like in a traditional operating
|
||||
system thread because NSE does not preempt Lua threads. Instead,
|
||||
we use a condition variable that the master thread
|
||||
<emphasis>waits</emphasis> on until awakened by a worker. The master
|
||||
we use a condition variable that the controller thread
|
||||
<emphasis>waits</emphasis> on until awakened by a worker. The controller
|
||||
will continually wait until all workers have terminated.
|
||||
</para>
|
||||
|
||||
@@ -3474,11 +3474,11 @@ end
|
||||
<para>
|
||||
When using condition variables, it is important to check the predicate
|
||||
before and after waiting. A predicate is a test on whether to continue
|
||||
doing work within a worker or master thread. For worker
|
||||
doing work within a worker or controller thread. For worker
|
||||
threads, this will at the very least include a test to see if the
|
||||
master thread is still alive. You do not want to continue doing work
|
||||
controller is still alive. You do not want to continue doing work
|
||||
when there's no thread to use your results. A typical test before waiting
|
||||
may be: Check whether the master is still running; if not, then quit.
|
||||
may be: Check whether the controller is still running; if not, then quit.
|
||||
Check if is work to be done; if not, then wait.
|
||||
</para>
|
||||
|
||||
@@ -3490,7 +3490,7 @@ end
|
||||
The usual, but not only, reason that this may happen
|
||||
is the termination of one of the threads using the condition variable. This
|
||||
is an important guarantee NSE makes that allows you to avoid deadlock
|
||||
where a worker or master waits for a thread to wake them up that ended
|
||||
where a worker or controller waits for a thread to wake them up that ended
|
||||
without signaling the condition variable.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
@@ -339,8 +339,8 @@ function mutex(object)
|
||||
--
|
||||
-- In NSE, Condition Variables are typically used to coordinate with threads
|
||||
-- created using the stdnse.new_thread facility. The worker threads must
|
||||
-- wait until work is available that the master thread (the actual running
|
||||
-- script) will provide. Once work is created, the master thread will awaken
|
||||
-- wait until work is available that the controller thread (the actual running
|
||||
-- script) will provide. Once work is created, the controller thread will awaken
|
||||
-- one or more workers so that the work can be done.
|
||||
--
|
||||
-- It is important to check the predicate (the test to see if your worker
|
||||
@@ -349,8 +349,8 @@ function mutex(object)
|
||||
-- guarantee your thread will not be awakened when no thread called
|
||||
-- <code>"signal"</code> or <code>"broadcast"</code> on the condition variable).
|
||||
-- One important check for your worker threads, before and after waiting,
|
||||
-- should be to check that the master script thread is still alive.
|
||||
-- (To check that the master script thread is alive, obtain the "base" thread
|
||||
-- should be to check that the controller thread is still alive.
|
||||
-- (To check that the controller thread is alive, obtain the "base" thread
|
||||
-- using stdnse.base and use coroutine.status). You do not want your worker
|
||||
-- threads to continue when the script has ended for reasons unknown to your
|
||||
-- worker thread. You are guaranteed that all threads waiting on a
|
||||
|
||||
@@ -97,7 +97,7 @@ end
|
||||
-- If known, the output includes some context based information: the script
|
||||
-- identifier and the target ip/port (if there is one). If the debug level is
|
||||
-- at least 2, it also prints the base thread identifier and whether it is a
|
||||
-- worker thread or the master thread.
|
||||
-- worker thread or the controller thread.
|
||||
--
|
||||
-- @class function
|
||||
-- @name debug
|
||||
|
||||
@@ -535,7 +535,7 @@ function process_interfaces( tbl )
|
||||
end
|
||||
|
||||
new_tbl[item.index] = item
|
||||
-- Add this interface index to our master list
|
||||
-- Add this interface index to our returned list
|
||||
table.insert( new_tbl.index_list, item.index )
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user