Mutual exclusion across user session in Citrix environment?

You don't need to use a lock file. You can use the built in file system sharing mechanism.

You don't need to use a lock file. You can use the built in file system sharing mechanism. When you open the file by calling CreateFile() you determine the sharing access for subsequent attempts to open the file with the dwShareMode parameter.

For example, set this to 0 and no other process will be able to open the file.

Thanks. But I would like open later when the other process finishes its task of writing to that file. Basically mutual exclusion – aJ.

Mar 7 at 9:17 @aJ When a process is finished writing, it calls CloseHandle on the file handle and then it's available again. Basically the interface to the filesystem already implements mutual exclusion for you. You really must not try to do it any other way!

– David Heffernan Mar 7 at 9:19 But the process has to wait till the other process calls CloseHandle. Does OS supports any mechanism to "know" when the other process finishes its writing? – aJ.

Mar 7 at 9:21 @aJ If the writing is quick and there's little contention, then you could just loop with a sleep. Otherwise you could go back to your mutex and use the global namespace rather than the local namespace which I'd guess was what you did wrong before. – David Heffernan Mar 7 at 9:26 Ah!

Global namespace--that might help me. Let me try. Thanks a lot.

– aJ. Mar 7 at 9:31.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions