开发者

how to use one file in a few threads

开发者 https://www.devze.com 2023-02-10 10:42 出处:网络
I have applicat开发者_如何学JAVAion 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 threa

I have applicat开发者_如何学JAVAion 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?


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


Here are links to some samples:

Win API, for C and C++, EnterCriticalSection

Also, in C#, nice threading article


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消