Multi-Threading
- From: Barkingmadscot <barry@xxxxxxxxxxxx>
- Date: Wed, 13 Feb 2008 00:00:41 -0800 (PST)
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(fileNm)
Dim AppThreads(4) As Thread
Dim WebData(intcount1) As DoWork
Do Until intcount > intcount1
WebData(Thread) = New DoWork
'################################
Code collecting data is here
################################
'# Setup and start new thread
AppThreads(Thread) = New Thread(AddressOf
WebData(Thread).sWriteWebUsage)
AppThreads(Thread).Start()
System.Threading.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(thread).start()
.
- Follow-Ups:
- Re: Multi-Threading
- From: Alex Clark
- Re: Multi-Threading
- From: Mr. Arnold
- Re: Multi-Threading
- From: Patrice
- Re: Multi-Threading
- Prev by Date: Re: Printing
- Next by Date: Re: Has MS given up on us (again)?
- Previous by thread: Re: Printing
- Next by thread: Re: Multi-Threading
- Index(es):
Relevant Pages
|