• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

VB.net Multi-threading problem.

Hi everyone!

I have built a web spider that is using Lucene to index the information.

However, when I implemented multi-threading, several threads are trying to write into the index at the same time, this generates an exception.

I assume the same happens with other cases, such as opening a file for writing with a thread, and then trying to access the file with another thread.

Could somebody provide some tips (code preferably) to avoid this thread conflicts or make the threads "wait" until the others have finished their job?

Thanks a lot!
1 Solution
Multithreading is a very deep topic. If you're using .NET collections, the framework can do a lot of work for you. Learn about the 'lock' keyword and the .Syncronized and .SyncRoot methods of most .NET collection classes:

All these have code examples:



Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now