문제

I have a BackgroundWorker that I use on a Search. Two different Searches can be done, one to a SQL DB and another to an Accpac DB. To accommodate for slow execution time to the Accpac DB, I use Thread.Sleep. The problem is, when I do a search on my SQL DB, I give parameters stating it should only return active records. If I move the Thread.Sleep to accommodate for my Accpac search, then my SQL results return all records instead of Active only. If I move Thread.Sleep to accommodate for my SQL search, then there are issues on the Accpac search results returned.

Are there any other alternatives other than Thread.Sleep?

도움이 되었습니까?

해결책

Sounds like you should look into Thread Synchronization classes such as WaitHandles. A ManualResetEvent would probably work pretty well for you.
http://www.yoda.arachsys.com/csharp/threads/waithandles.shtml

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top