Starting .exe "single threaded"

M

Martin Ink

I have a program linked to an .exe and this program is started from an
other program.
I would like to control the execution of the program so that the
program only runs 'single threaded'. I don't want simultaneously
session of my program to be run.
My program must be an .exe.
Is there a way to control this in a simple way ??

Rgds
 
J

John Harrison

Martin Ink said:
I have a program linked to an .exe and this program is started from an
other program.
I would like to control the execution of the program so that the
program only runs 'single threaded'. I don't want simultaneously
session of my program to be run.
My program must be an .exe.
Is there a way to control this in a simple way ??

Rgds

There is no support in standard C++ for threading or restricting execution
to a single instance (which is what I think you really mean by single
threaded). Try a windows programming group like
instead, you are off topic here.

john
 
S

Snyke

Martin said:
I have a program linked to an .exe and this program is started from an
other program.
I would like to control the execution of the program so that the
program only runs 'single threaded'. I don't want simultaneously
session of my program to be run.
My program must be an .exe.
Is there a way to control this in a simple way ??

Rgds
I would suggest to create a file in a known directory such as
appname.lock . Upon startup the program checks wether such a file
exists, if yes it closes. There's still the problem of unclean closes
that do not delete the locks once the program closes, but that's to you
to solve (file creation date check...?).
 
T

Tom Widmer

I have a program linked to an .exe and this program is started from an
other program.
I would like to control the execution of the program so that the
program only runs 'single threaded'. I don't want simultaneously
session of my program to be run.
My program must be an .exe.
Is there a way to control this in a simple way ??

Typically this is done either with a global named mutex or with a file
lock. In either case, ask in a group that deals in programming
questions about your platform.

Tom
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top