How to find whether the proces is running or not?

S

Sabiyur

Hi All,
I am working on Windows platform.
Is there any way to find out whether the given process running?

( History: I am using WaitForSingleObject. People advised me the
WaitForSingleObject could hang if the process for which we are waiting
terminated earlier to calling WaitForSingleObject. So I am trying to
check whether the given process is running)


Thanks
Sabiyur
 
O

Obnoxious User

Sabiyur skrev:
Hi All,
I am working on Windows platform.
Is there any way to find out whether the given process running?

( History: I am using WaitForSingleObject. People advised me the
WaitForSingleObject could hang if the process for which we are waiting
terminated earlier to calling WaitForSingleObject. So I am trying to
check whether the given process is running)

Try

http://support.microsoft.com/kb/175030
 
J

James Kanze

I am working on Windows platform.
Is there any way to find out whether the given process running?
( History: I am using WaitForSingleObject. People advised me the
WaitForSingleObject could hang if the process for which we are waiting
terminated earlier to calling WaitForSingleObject. So I am trying to
check whether the given process is running)

It depends on the system; Posix's waitpid(), for example, has a
WNOHANG option which effectively prevents blocking. On some
systems, you can set a timeout on the process wait, and setting
it to 0 effectively means to poll; this is the case for Window's
WaitForSingleObject, for example.

Otherwise, the classical solution is to spawn a separate thread,
and wait there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top