Eric Sosman <Eric.Sosman@sun.com> wrote in message news:<41125005.2070201@sun.com>...
>
> As far as I know there's no API to answer this question.
> That should be something of a hint, really: If the people
> who designed the threading APIs had thought the question
> had a useful answer, they'd presumably have invented an
> API to answer it. The experts didn't invent such an API,
> so it's likely they didn't see the question as useful.
If one person answer that no API exist, there is no reason to
believe he is right. In this thread, many people said so, so
I believe.
>
> So: Why do you want to know the answer to this question
> that didn't appear to interest the experts?
Even experts might not be thinking of everything, which is
useful.
> What do you
> intend to do with the answer once you have it? What is
> the larger problem you're trying to solve? There may be a
> better solution than learning that "Seven threads are
> running -- or, rather, *were* running a microsecond ago."
My application should have a system status page, where yuo get
some information about the system, i.e. free memory, free
disc space, average load, number of currently running processes
and number of own threads. If there is a problem with the
application, customer can look to this page. If you have enough
memory (both on disc and RAM), not much running processes,
but a high load and a large number of threads for this application
(for example one thousand or so, it is a heavily multithreaded
application), there might be a problem with the application.
This application is running on Solaris, Linux and Windows and
there is no problem to get the number of own threads on
Solaris and Windows. So I am surprised it is a problem on
Linux. The class which retrieves the information should be
usefull for other applications as well, so I don't want to
wrap the thread class to count the threads just to get this
information for Linux. The "solution" might be simply
not to show the number of threads on Linux.