I am having problems with Multi-threading and write to Key Access
Database
I have a log file that and collecting infomation from
getting the info is a problem or is writing it the database, the log
files a big and it takes time to read down as it get further in to log
said, a 100,000 line in
I have changed it to mutli-threading which almost works, the problem
is when writing data to the table. I get dup keys and the whole
stops, this does not happen with the single thread app.
basically i want each thread to wait until thread before finish its
write to the database.
ie.
thread 1 waits for thread 0 to finish writing to table
thread 2 waits for thread 1 to finsih writing to table
thread 4 waits for ..........
during this each for the thread have collected the data they need to
write to the table.
Here is the line code to
Dim intcount As Integer = 1, intcount1 As Integer =
fNoOfLines(file Nm)
Dim AppThreads(4) As Thread
Dim WebData(intcoun t1) As DoWork
Do Until intcount intcount1
WebData(Thread) = New DoWork
'############## ############### ###
Code collecting data is here
############### ############### ##
'# Setup and start new thread
AppThreads(Thre ad) = New Thread(AddressO f
WebData(Thread) .sWriteWebUsage )
AppThreads(Thre ad).Start()
System.Threadin g.Thread.Sleep( 15)
intcount = intcount + 12
Loop
I removed all the code that does the data collecting as it works
fine,
I believe my problem is at the Appthreads(thre ad).start()
Database
I have a log file that and collecting infomation from
getting the info is a problem or is writing it the database, the log
files a big and it takes time to read down as it get further in to log
said, a 100,000 line in
I have changed it to mutli-threading which almost works, the problem
is when writing data to the table. I get dup keys and the whole
stops, this does not happen with the single thread app.
basically i want each thread to wait until thread before finish its
write to the database.
ie.
thread 1 waits for thread 0 to finish writing to table
thread 2 waits for thread 1 to finsih writing to table
thread 4 waits for ..........
during this each for the thread have collected the data they need to
write to the table.
Here is the line code to
Dim intcount As Integer = 1, intcount1 As Integer =
fNoOfLines(file Nm)
Dim AppThreads(4) As Thread
Dim WebData(intcoun t1) As DoWork
Do Until intcount intcount1
WebData(Thread) = New DoWork
'############## ############### ###
Code collecting data is here
############### ############### ##
'# Setup and start new thread
AppThreads(Thre ad) = New Thread(AddressO f
WebData(Thread) .sWriteWebUsage )
AppThreads(Thre ad).Start()
System.Threadin g.Thread.Sleep( 15)
intcount = intcount + 12
Loop
I removed all the code that does the data collecting as it works
fine,
I believe my problem is at the Appthreads(thre ad).start()
Comment