Effective thread Synchronization in C#

Posted by n0vic3c0d3r on Stack Overflow See other posts from Stack Overflow or by n0vic3c0d3r
Published on 2010-03-25T12:06:00Z Indexed on 2010/03/25 12:13 UTC
Read the original article Hit count: 527

Filed under:
|
|

I have a scenario where I need to search from many binary files (using keys) and combine the results (strings). Until now, I have been doing it in a for loop one file after the other.

foreach (string file in FileSources.Keys)
{
    aggregatedDefinitions.Append(DefinitionLookup(txtSearchWord.Text, file));
}

Since this operation is very slow, I was thinking of using threads, so that I could do IO operations in parallel. Is threading the right way to go. If I use threading, how can I ensure that I get the results in the order I want.

I haven't used Threading until now. It would be very helpful if you could suggest some materials/books that would help me solve my problem.

© Stack Overflow or respective owner

Related posts about c#

Related posts about multithreading