I coded window services that watch folders for line addition to file in
those folders.
On file watch event it parse the file and insert the last line to a mssql
server
Since I have about 50 sources (tests values returned from various
instruments) updating the files I opened thread for each file io.
I can't count on the parsing returned in the same order it entered because
the files are big and different size.
My question is how to block threads inserting rows to the wrong tables?
I locked the relevant values
---------------------
state _state;
IDictionary settings ;
lock(finishedLock)
{
// sql table columns names
settings =
(IDictionary)System.Configuration.ConfigurationSettings.GetConfig("ImpFiles"
) ;
// file stream returned from BeginRead
_state = (state) asyncResult.AsyncState;
}
--------------------
Am I doing it right? Is it redundant anyway ?
TIA
A
===================================
This list is hosted by DevelopMentor� http://www.develop.com
Some .NET courses you may be interested in:
Essential .NET: building applications and components with CSharp
August 30 - September 3, in Los Angeles
http://www.develop.com/courses/edotnet
View archives and manage your subscription(s) at http://discuss.develop.com