diff --git a/nselib/nmap.luadoc b/nselib/nmap.luadoc index 9e6f6ca9f..11111496f 100644 --- a/nselib/nmap.luadoc +++ b/nselib/nmap.luadoc @@ -201,14 +201,15 @@ 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. +-- 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 -- 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 condition --- variable will be awakened if any thread that has accessed the condition --- variable via nmap.condvar ends for any reason. This is --- essential to prevent deadlock with threads waiting for another thread to awaken +-- worker thread. You are guaranteed that all threads waiting on a +-- condition variable will be awakened if any thread that has accessed +-- the condition variable via nmap.condvar ends for any +-- reason. This is essential to prevent deadlock with threads +-- waiting for another thread to awaken -- them that has ended unexpectedly. -- @see stdnse.new_thread -- @see stdnse.base diff --git a/nselib/stdnse.lua b/nselib/stdnse.lua index 681c0a451..1dbc7ac6f 100644 --- a/nselib/stdnse.lua +++ b/nselib/stdnse.lua @@ -520,13 +520,13 @@ end -- and mutex (nmap.mutex) facilities to coordinate with your -- worker threads. Keep in mind that Nmap is single threaded so there are -- no (memory) issues in synchronization to worry about; however, there --- is resource contention. Your resources are usually network bandwidth, --- network sockets, etc. Condition variables are also useful if the work for any --- single thread is dynamic. For example, a web server spider script with a pool --- of workers will initially have a single root html document. Following the --- retrieval of the root document, the set of resources to be retrieved --- (the worker's work) will become very large (an html document adds many --- new hyperlinks (resources) to fetch). +-- is resource contention. Your resources are usually network +-- bandwidth, network sockets, etc. Condition variables are also useful if the +-- work for any single thread is dynamic. For example, a web server spider +-- script with a pool of workers will initially have a single root html +-- document. Following the retrieval of the root document, the set of +-- resources to be retrieved (the worker's work) will become very large +-- (an html document adds many new hyperlinks (resources) to fetch). --@name new_thread --@class function --@param main The main function of the worker thread.