I have a multi threaded VB.NET application (4 threads) that I use to send
text messages to many, many employees via system.timer at a 5 second
interval. Basically, I look in a SQL table (queue) to determine who needs
to receive the text message then send the message to the address. Only
problem is, the employee may receive up to 4 of the same messages because
each thread gets the recors then sends the message. I need somehow to
prevent this... just can't think of how. Somehow I need the other threads
to know that another thread is already using that record and move on to the
next record. I thought of getting the record then marking it (column value)
as in use and writing the code to look for records only where not in use...
problem is all 4 run fast enough to all use/mark the row. Any thoughts?
Thanks a lot.
Jay
text messages to many, many employees via system.timer at a 5 second
interval. Basically, I look in a SQL table (queue) to determine who needs
to receive the text message then send the message to the address. Only
problem is, the employee may receive up to 4 of the same messages because
each thread gets the recors then sends the message. I need somehow to
prevent this... just can't think of how. Somehow I need the other threads
to know that another thread is already using that record and move on to the
next record. I thought of getting the record then marking it (column value)
as in use and writing the code to look for records only where not in use...
problem is all 4 run fast enough to all use/mark the row. Any thoughts?
Thanks a lot.
Jay
Comment