By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,179 Members | 2,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,179 IT Pros & Developers. It's quick & easy.

Starting .exe "single threaded"

P: n/a
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
Jul 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Martin Ink" <ma****@dkonsult.se> wrote in message
news:3b**************************@posting.google.c om...
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
news:comp.os.ms-windows.programmer.win32 instead, you are off topic here.

john
Jul 22 '05 #2

P: n/a
Martin Ink wrote:
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...?).
Jul 22 '05 #3

P: n/a
On 3 Oct 2004 05:18:59 -0700, ma****@dkonsult.se (Martin Ink) wrote:
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
Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.