473,387 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Mutex needed? multiple readers of an XML file

Just wondering if I need to add a Mutex around this section (and if so,
where) where multiple apps will be making the static method call:

public static bool GetDBConn(string dbName, out string connString, out
string dbType)
{
string XMLPath = ConfigurationSettings.AppSettings["xmlFilePath"];

XmlDocument ConnXMLDoc = new XmlDocument();

ConnXMLDoc.Load(XMLPath);

// ... etc ...

}


Nov 15 '05 #1
1 1893
"pokémon" <po**@mon.com> wrote in message
news:Ls******************@nwrdny02.gnilink.net...
Just wondering if I need to add a Mutex around this section (and if so,
where) where multiple apps will be making the static method call:

public static bool GetDBConn(string dbName, out string connString, out
string dbType)
{
string XMLPath = ConfigurationSettings.AppSettings["xmlFilePath"];

XmlDocument ConnXMLDoc = new XmlDocument();

ConnXMLDoc.Load(XMLPath);

// ... etc ...

}


You need some synchronization device (like mutex) only when you have some
shared resource accessed/updated by more than one thread (process.) I don't
know what you want to do in the "...etc..." but your code so far doesn't
need synchronization.
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Srijit Kumar Bhadra | last post by:
Hello, Here is some sample code with pywin32 build 203 and ctypes 0.9.6. Best regards, /Srijit File: SharedMemCreate_Mutex_win32all.py # This application should be used with...
5
by: Ken Varn | last post by:
I have a named mutex object that is accessed by both an asp.net application and a Windows executable .net application. The Windows executable runs under the administrator logon, while the asp.net...
3
by: smith4894 | last post by:
Hello, I have an application that essentially consists of two threads doing their things. One thread is a producer, and pushes bytes (of a struct) into a pipe, and another is a consumer that...
17
by: Mark Rae | last post by:
Hi, I have a WinForms desktop MDI application written in C#. Following advice from others in this forum, I prevent multiple instances of the app running at the same time by creating / trying to...
16
by: Ed Sutton | last post by:
I use a mutex to disallow starting a second application instance. This did not work in a release build until I made it static member of my MainForm class. In a debug build, first instance got...
1
by: Gery D. Dorazio | last post by:
Here is some code to open a file with exclusive access for the purpose of modifying it. FileStream fstrm = new FileStream(inputFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite,...
7
by: UJ | last post by:
Has anybody seen an 'Access denied' error when trying to create a mutex? If so - what does that mean? I though Mutex's were not supposed to error out. TIA - Jeff.
11
by: Lamont Sanford | last post by:
Given an object of type Mutex, what method or property should be called to determine if it is currently owned? I could call WaitOne(0,false) -- and if the return value is false, I could deduce...
2
by: tshad | last post by:
I am running a program as a Windows service which works fine. I am using a Mutex to prevent multiple threads from from accessing my log text file at the same time. It works fine in the Service:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.