Re: Sharing Data in DLLs
- From: "Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT dot.state.fl.us>
- Date: Mon, 7 Aug 2006 09:54:40 -0400
Hi,
You should have the file open the less possible time, so you should
open/close it in each call.
Even more, it's possible that more than one process will try to write to it
at the same time. so you will still have a problem.
Possible solutions:
1- Use event log instead of a file.
2- Use a dedicated thread to write down the events, this thread will use a
sync queue to store the log entries that need to be written. it will fire
from time to time and try to write the entries to the file. The entries will
be generated by the UI thread (or any other worker thread)
Hope this help,
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Rajesh" <Rajesh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3A3AE75E-1131-4D63-A2BB-553334D9CFB5@xxxxxxxxxxxxxxxx
Hi,
We are tyring to build a DLL which will write the log data to a text file.
Multiple executables should use this dll to write data to same text file.
We
are using a synchronized method (using TextWriter.Synchronized) for
writing
data to the text file. The class in the DLL (LogManagement) is implemented
using the Singleton pattern.
My problem is that when I try to write data from more that one executables
(and services) it gives me error and does not allow write to the file.
Any help is appreciated.
Thanks
Rajesh
http://www.slcltd.com
.
- Prev by Date: handling onscroll event of WebBrowser
- Next by Date: Re: Security!
- Previous by thread: Re: Sharing Data in DLLs
- Next by thread: WinScard.dll, ScardTransmit
- Index(es):
Relevant Pages
|