Sign in to follow this  
akjal

[.net] Multiple application accessing same file

Recommended Posts

Hi I have a dll(say DLL1) which log the execution sequence into a text file dll1.txt . Two applications ,say APP1 and APP2 (running in the same machine) are using the DLL1 . The problem is, sometimes, therre is a chance that APP1 and APP2 access the DLL1 which in turn accesses the text file at the same time. This leads to a contention betweeen applications and applications halt. The code for Logging is thread safe within an application. That is, even if the a single application has got more than one threads, it will be managed. Any help will be greatly appreciated. Thanks in advance

Share this post


Link to post
Share on other sites
Hi guys,

I solve the issue by using a concept called system level mutex include in System.Threading.Mutex class of .NET.


These are the some links helped me to solve this issue.

http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=605
http://msdn.microsoft.com/en-us/library/aa332344(VS.71).aspx


Thanks everybody
akjal

Share this post


Link to post
Share on other sites
Yeah I think mastering a Mutex is an invaluable skill to have especially considering most PC's now have multi-core processors.

I had no idea you could use them on a system level or with file sharing. Especially handy considering you can use them along with unmanaged code. Thanks for the links.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this