Multi-thread concurrency control

Asked

Viewed 231 times

0

I need to develop a Windows Service with C# that checks a table in the database (Sql Server 2008). This table has the data I need and a Status field(Ready,Processing, Processed, Error).

The service will always get the first result with Status Ready, and as soon as it does, it will update the status to Processing.

Now my question, what is the best way to do the competition control of this, because I intend to use 4 simultaneous threads.

How to make threads not catch a repeated value?

  • Why do you need 4 simultaneous threads to check the status? You can not consult in just one, and this create the new threads to process your information. What will make this service?

  • Yes, I’m thinking about doing a single search and adding to a list, and making a manager of that list by passing the ID and removing it from the list. I think that way it’ll get more performative.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.