From 030a58a26e9464afa0731b945fe62380413fef24 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 18 Jun 2020 17:14:48 +0000 Subject: [PATCH] Replace 'master' with 'controller thread' in NSE script docs/comments --- docs/scripting.xml | 14 +++++++------- nselib/nmap.luadoc | 8 ++++---- nselib/stdnse.lua | 2 +- scripts/snmp-interfaces.nse | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/scripting.xml b/docs/scripting.xml index 949a22913..ff4817593 100644 --- a/docs/scripting.xml +++ b/docs/scripting.xml @@ -3402,11 +3402,11 @@ end For example, consider the earlier . 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 poll 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 - waits on until awakened by a worker. The master + we use a condition variable that the controller thread + waits on until awakened by a worker. The controller will continually wait until all workers have terminated. @@ -3474,11 +3474,11 @@ end 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. @@ -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. diff --git a/nselib/nmap.luadoc b/nselib/nmap.luadoc index 3dd204eeb..e9942d93f 100644 --- a/nselib/nmap.luadoc +++ b/nselib/nmap.luadoc @@ -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 -- "signal" or "broadcast" 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 diff --git a/nselib/stdnse.lua b/nselib/stdnse.lua index 38b128afe..a173bf057 100644 --- a/nselib/stdnse.lua +++ b/nselib/stdnse.lua @@ -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 diff --git a/scripts/snmp-interfaces.nse b/scripts/snmp-interfaces.nse index e35dbbbf7..18645fa50 100644 --- a/scripts/snmp-interfaces.nse +++ b/scripts/snmp-interfaces.nse @@ -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