|Title:||[info pid] and [info tid] Subcommands|
|Version:||$Revision: 1.9 $|
|Author:||Joe Mistachkin <joe at mistachkin dot com>|
|Created:||Sunday, 21 March 2004|
This TIP proposes two new info subcommands which are used to obtain the current process and thread identifiers.
In certain types of applications, it is important to know what thread is currently executing. This is especially true for multithreaded applications or for scripts running in a threaded build of Tcl.
While the author realizes that there is already a pid command, the addition of the info pid subcommand still makes sense for the following reasons:
The pid command can also provide information totally unrelated to the current process identifier. At one point (TIP #88) it was even suggested that the pid command be overloaded to provide process control related functionality.
To allow scripts that dynamically build other scripts (potentially for use with safe interpreters) using the info command and caller provided arguments. Using the info command instead of the pid command limits the amount of information that can be obtained by the safe interpreter.
It is the opinion of the author that informational commands, such as pid should really be subcommands of info as we start to move forward with the development of Tcl.
The info tid command should be in the core because the identity of the currently executing thread is just as fundamental on all modern operating systems as the current process identity. Once the thread identity is known, it can be used to communicate with other processes and threads in useful ways that do not require the Thread package. Loading the entire Thread package just to get the identity of the currently executing thread is overkill and may not be a good solution in application embedding scenarios. This is especially true for the browser plugin where loading extra packages is not ideal.
Two new subcommands, info pid and info tid, would be added to the info command with the following syntax:
This subcommand would return the process identifier for the current process.
This subcommand would return the thread identifier for the current thread.
A complete implementation of this TIP is available .
This document has been placed in the public domain.
[Index] [History] [Edit] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]TIP AutoGenerator - written by Donal K. Fellows