![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: Is there a way to now how many threads a process has running at one time ? I'm developing a multithread server and want to know if I'm destroying all threads when the client disconnects. But I havent found a way to see the number of threads currently act ive. Thanks for the time. The Answer is : If you as the developer are wondering if your application is working as expected, then the OpenVMS Wizard would recommend running your application under the debugger and using the SHOW TASK or SHOW THREAD commands (depending on which version of the debugger you are using). If you seek some way for your application to determine programmatically (i.e., at run-time) what threads exist, the OpenVMS Wizard would recommend your application track what threads have been created; any thread which has not yet joined (or detached) can be considered to still exist. As for threads created by subsystems of your application, those subsystems should keep track of them and provide a mechanism for the calling code to request their termination. Beyond that, there is no way for any single component of an application to see all threads in the process, as that runs counter to the notion of modular software construction. You could of course simply exit and restart the application (via a call to LIB$DO_COMMAND or otherwise) if the application environment becomes hopelessly snarled and confused.
|