mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Replace 'master' with 'controller thread' in NSE script docs/comments
This commit is contained in:
@@ -3402,11 +3402,11 @@ end
|
|||||||
<para>
|
<para>
|
||||||
For example, consider the earlier <xref
|
For example, consider the earlier <xref
|
||||||
linkend="nse-worker-example"/>. Until all
|
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
|
<literal>poll</literal> for results like in a traditional operating
|
||||||
system thread because NSE does not preempt Lua threads. Instead,
|
system thread because NSE does not preempt Lua threads. Instead,
|
||||||
we use a condition variable that the master thread
|
we use a condition variable that the controller thread
|
||||||
<emphasis>waits</emphasis> on until awakened by a worker. The master
|
<emphasis>waits</emphasis> on until awakened by a worker. The controller
|
||||||
will continually wait until all workers have terminated.
|
will continually wait until all workers have terminated.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -3474,11 +3474,11 @@ end
|
|||||||
<para>
|
<para>
|
||||||
When using condition variables, it is important to check the predicate
|
When using condition variables, it is important to check the predicate
|
||||||
before and after waiting. A predicate is a test on whether to continue
|
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
|
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
|
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.
|
Check if is work to be done; if not, then wait.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -3490,7 +3490,7 @@ end
|
|||||||
The usual, but not only, reason that this may happen
|
The usual, but not only, reason that this may happen
|
||||||
is the termination of one of the threads using the condition variable. This
|
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
|
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.
|
without signaling the condition variable.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|||||||
@@ -339,8 +339,8 @@ function mutex(object)
|
|||||||
--
|
--
|
||||||
-- In NSE, Condition Variables are typically used to coordinate with threads
|
-- In NSE, Condition Variables are typically used to coordinate with threads
|
||||||
-- created using the stdnse.new_thread facility. The worker threads must
|
-- created using the stdnse.new_thread facility. The worker threads must
|
||||||
-- wait until work is available that the master thread (the actual running
|
-- wait until work is available that the controller thread (the actual running
|
||||||
-- script) will provide. Once work is created, the master thread will awaken
|
-- script) will provide. Once work is created, the controller thread will awaken
|
||||||
-- one or more workers so that the work can be done.
|
-- 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
|
-- 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
|
-- guarantee your thread will not be awakened when no thread called
|
||||||
-- <code>"signal"</code> or <code>"broadcast"</code> on the condition variable).
|
-- <code>"signal"</code> or <code>"broadcast"</code> on the condition variable).
|
||||||
-- One important check for your worker threads, before and after waiting,
|
-- One important check for your worker threads, before and after waiting,
|
||||||
-- should be to check that the master script thread is still alive.
|
-- should be to check that the controller thread is still alive.
|
||||||
-- (To check that the master script thread is alive, obtain the "base" thread
|
-- (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
|
-- 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
|
-- threads to continue when the script has ended for reasons unknown to your
|
||||||
-- worker thread. You are guaranteed that all threads waiting on a
|
-- 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
|
-- 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
|
-- 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
|
-- 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
|
-- @class function
|
||||||
-- @name debug
|
-- @name debug
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ function process_interfaces( tbl )
|
|||||||
end
|
end
|
||||||
|
|
||||||
new_tbl[item.index] = item
|
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 )
|
table.insert( new_tbl.index_list, item.index )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user