Solved

Which way to semaphore? File? Registry? CreateWindow? Something else?

Posted on 2004-04-06
3
453 Views
Last Modified: 2008-02-26
I am writing a class which sometimes needs to pass semaphores (interprocess flags) to other instances of itself.  (I don't want some functions run by more than one instance of the class on the same machine simultaneously.)  I am hoping to distribute the class for use in a wide variety of environments and have been trying to figure out the best way to semaphore.

The component may be installed in an environment where it is not able to write to the disk, so I can't rely on temporary files.

I have considered using registry read/writes, but as it is possible to protect the registry, I am guessing that I can't really rely on any given key in the registry being writable either, plus I guess there's a bit of a performance overhead if I have to keep reading and writing to the registry all the time.

My current best guess is to use CreateWindow and FindWindow API calls, to create a window, and then check for it's existence. The only problem I can see with this method is that it assumes a single device context and so would probably not work in Terminal Server/Citrix environments.

Is there another method that I don't know about. How do you guys do it?
0
Comment
Question by:molar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
mirzas earned 500 total points
ID: 10764062
0
 
LVL 2

Author Comment

by:molar
ID: 10764985
Thanks mirzas, Just what I needed.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question