diff --git a/docs/scripting.xml b/docs/scripting.xml index 999395cdc..599029308 100644 --- a/docs/scripting.xml +++ b/docs/scripting.xml @@ -2581,13 +2581,13 @@ error_message describes the occurred error. To solve this problem, there is an nmap function, - mutex that provides a + mutex, that provides a mutex usable by scripts. The mutex allows for only one thread to be working on an object. Threads waiting to work on this object are put in the waiting queue until they can get a "lock" on the mutex. A solution for the whois.nse problem above is to have each thread - block on a mutex for the script's ID field + block on a mutex for script's ID field , thus ensuring only one thread is working so its results can be shared with other scripts which may not need to run and so queries to the whois servers are staggered. @@ -2611,35 +2611,35 @@ error_message describes the occurred error. - - Make a blocking lock on the mutex. If the mutex is busy + "lock"—Make a blocking lock on the + mutex. If the mutex is busy (another thread has a lock on it), then the thread will yield and wait. The function returns with the mutex locked. - - Makes a non-blocking lock on the mutex. If the mutex is + "trylock"—Makes a non-blocking lock + on the mutex. If the mutex is busy then it immediately returns with a return value of false. Otherwise the mutex locks the mutex and returns true. - - Releases the mutex and allows another thread to lock it. + "done"—Releases the mutex and allows + another thread to lock it. If the thread does not have a lock on the mutex, an error will be raised. - - Returns the thread locked on the mutex or nil. This + "running"—Returns the thread locked + on the mutex or nil. This should only be used for debugging as it interferes with finished threads from being collected.