how to use one file in a few threads

118 views Asked by At

I have application where I'm using a tabPage controls. In each of this controls I read data from the excel file and then analyze the data in separate threads. How make to a few threads can read data from one excel file?

4

There are 4 answers

0
Andriy Tylychko On

read data into memory and synchronize access from different threads by mutex (probably CriticalSection in your case)

0
Chris O On

Here are links to some samples:

Win API, for C and C++, EnterCriticalSection

Also, in C#, nice threading article

0
David Heffernan On

Assuming you are using the COM interface to Excel, and you are working on a single workbook, you can only read/write from/to of Excel from a single thread.

0
chiku On

You will have to read the data in the memory. This data in the record format could be put up in a Queue where threads can pick up tasks. You may want to look at the java.util.concurrent package in Java.