<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://panoptic.com/mediawiki/aolserver/index.php?action=history&amp;feed=atom&amp;title=Ns_thread</id>
	<title>Ns thread - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://panoptic.com/mediawiki/aolserver/index.php?action=history&amp;feed=atom&amp;title=Ns_thread"/>
	<link rel="alternate" type="text/html" href="https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_thread&amp;action=history"/>
	<updated>2026-04-13T01:34:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_thread&amp;diff=2794&amp;oldid=prev</id>
		<title>WikiSysop: imported from WiKit id 498</title>
		<link rel="alternate" type="text/html" href="https://panoptic.com/mediawiki/aolserver/index.php?title=Ns_thread&amp;diff=2794&amp;oldid=prev"/>
		<updated>2004-09-24T18:44:34Z</updated>

		<summary type="html">&lt;p&gt;imported from WiKit id 498&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Man page: http://aolserver.com/docs/tcl/ns_thread.html&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
'''NAME'''&lt;br /&gt;
&lt;br /&gt;
: ns_thread - Operate on threads&lt;br /&gt;
&lt;br /&gt;
'''SYNOPSIS'''&lt;br /&gt;
&lt;br /&gt;
: '''ns_thread''' ''option ?arg arg ...?''&lt;br /&gt;
&lt;br /&gt;
'''DESCRIPTION'''&lt;br /&gt;
&lt;br /&gt;
: This command provides a mechanism to manipulate threads.  The legal ''option''s (which may be abbreviated) are:&lt;br /&gt;
* '''ns_thread begin''' ''script''&lt;br /&gt;
* '''ns_thread create''' ''script''&lt;br /&gt;
&lt;br /&gt;
: Initializes a new thread and starts it executing ''script''.  Threads created this way are joinable and must be '''ns_thread join'''ed, otherwise the resources held by the thread will not be freed until the thread is joined.  Returns a handle to the new thread.&lt;br /&gt;
* '''ns_thread begindetached''' ''script''&lt;br /&gt;
&lt;br /&gt;
: Initializes a new thread and starts it executing ''script''.  Threads created this way are detached and do not need to be (nor can be) joined.&lt;br /&gt;
* '''ns_thread get'''&lt;br /&gt;
&lt;br /&gt;
: Returns the handle for the current thread.&lt;br /&gt;
* '''ns_thread getid''' ~~~&lt;br /&gt;
* '''ns_thread id'''&lt;br /&gt;
&lt;br /&gt;
: Returns the current thread's thread ID as an integer.  This thread ID corresponds to the third element in the sub-list returned from [[ns_info]] '''threads'''.&lt;br /&gt;
* '''ns_thread name''' ''?name?''&lt;br /&gt;
&lt;br /&gt;
: Returns the name of the current thread.  Optionally sets the thread name if ''name'' is specified.&lt;br /&gt;
* '''ns_thread join''' ''tid'' ~~~&lt;br /&gt;
* '''ns_thread wait''' ''tid''&lt;br /&gt;
&lt;br /&gt;
: Attempts to join the thread specified by thread handle ''tid''.  If the thread is still executing, the caller will block until the thread being joined completes.  Returns the return value of the script that the thread being joined was executing.&lt;br /&gt;
&lt;br /&gt;
: '''NOTE:''' Attempting to join a thread that has already been joined will currently crash the server.&lt;br /&gt;
* '''ns_thread yield'''&lt;br /&gt;
&lt;br /&gt;
: Causes the current thread to yield its CPU to other running threads.&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
Calling '''ns_thread join''' on an invalid thread ID or a thread ID that has already been joined will cause the server to abort with a fatal error.  See [http://aolserver.com/sf/bug/962387 SF Bug #962387] for details.&lt;br /&gt;
&lt;br /&gt;
'''EXAMPLES'''&lt;br /&gt;
&lt;br /&gt;
'''SEE ALSO'''&lt;br /&gt;
&lt;br /&gt;
: [[ns_cond]], [[ns_event]], [[ns_mutex]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[Category Documentation]] - [[Category Core Tcl API]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
		
	</entry>
</feed>