So I separated some write functions, that update a XML file into separate classes, that generate a thread in the background to open, update and write the XML file using streamreader and streamwriter.
So I'm new to threads on vb managed code, and just found that StreamReader is not thread safe. I did some research and one MSDN article says I need to wrap the streamreader in textreader and synchronize.
I did some more research, stumbled across monitor.enter and monitor exit, and the singleton class, so that only 1 instance of the class can run at a time.
So I have a file called "Landing.xml" and I'm interested in only have 1 instance of the class work the file at a time.
Just looking for suggestions, or help with implementing. Will post code is someone asks.
Well I tried using monitor and so far so good. So I have like 15 of these class files that handle 1 xml file each, and they seem to be queuing up correctly, and waiting politely for the previous instance of itself to complete before firing again.
So the Yandex and Baidu bots have visited, and the updates were handled without error this time over the last 3 hour test period.
Well time will tell, will check the results again in the morning.
Still interested in the Singleton concept. Not quite sure how to implement it in vb
Last Visit: 31-Dec-99 18:00 Last Update: 23-Jun-17 11:20