Hi Tim, > It's not quite clear whether you want something which you can build into the > application itself
Yes, since I control the source code, this is a feature I would like to build into my applications. > ... in which case, the answer's probably Semaphores: > http://msdn.microsoft.com/en-us/library/ms685129%28VS.85%29.aspx Thanks for that link. My understanding is that semaphores only to apply to threads within a single running application? On the other hand, perhaps the term 'threads' applies to applications as well? I say that because the term thread is used to describe mutex's which I've used on a program vs. thread basis. Microsoft's description of Mutex's http://msdn.microsoft.com/en-us/library/ms684266%28VS.85%29.aspx My research on semaphors also leads me to believe that if an application incremented a semaphor and crashed without decrementing the semaphore, then my semaphore count would be incorrect. Since the code in question is being run in a test environment, the possibility of abnormal terminations is higher than one would normally expect. Does this sound accurate to you? > Obviously there are other approaches: you could write transient pid files in > the Unix fashion, you could use Job objects to group your processes together > in one job: http://msdn.microsoft.com/en-us/library/ms684161%28VS.85%29.aspx What are your thoughts on using a pre-assigned list of mutexes. An application would walk a list of named mutex's trying to lock one for itself. If an application iterated through a list of mutex's without securing one for itself, it would exit. The advantage of mutex's over semaphores would be that applications that terminate abnormally would have their mutex released, while applications using semaphors that terminated abnormally would leave their semaphore with an incorrect count? The disadvantage of using mutex's vs. semaphores is that the time to find a free mutex might be much slower than the time to simply increment or decrement a semaphor. On the other hand, one of my colleagues claims that neither semphores or mutuxes will be visible to other Terminal Service users. In other words, all I will be able to do with semaphores and mutex's is to make sure a SPECIFIC user doesn't run an application more than once. Put another way, there may be no such thing as Global (that are visible across user sessions) semaphores and mutex's. So I'm back to thinking about your PID file idea :) Regards, Malcolm _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32