Solved

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

Posted on 2004-04-06
3
450 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
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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 10765000
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

803 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