Hi Everybody!
I am still learning how to take full advantage of threading in VB.Net. There seems to be a swamp of information out there that just seems to confuse me more.
My specific question relates to synchronization. I have some software that performs a lengthy file IO operation (Threads and IO). During this operation the GUI becomes unresponsive because it is tied up. I want to pass the file operation off to separate thread and allow to main GUI thread to keep pumping messages and responding. Many options exist, I have been using ThreadPool.QueueUserWorkItem in the past with great success.
My problem is that I want to wait for that thread to complete before I continue with further operations. I think I want to use ManualResetEvent but am unsure how to apply it.
It would also be nice if there is a timeout on such a device. If the file op. fails or something else it would be nice if it timed out and returned anyway.Code:Public Sub DoStuff() { Operation1() ThreadPool.QueueUserWorkItem(addressof FileOperation()) Operation2() //Do not process until worker thread has returned }
I have found things like the Mutex and Monitor class but they seem to lock variables. I actually need to halt further processing of the main thread's code until my worker has returned.
Just a little lost in massive world of threading support.
Thanks ppl,
Matt.




). During this operation the GUI becomes unresponsive because it is tied up. I want to pass the file operation off to separate thread and allow to main GUI thread to keep pumping messages and responding. Many options exist, I have been using ThreadPool.QueueUserWorkItem in the past with great success.
Reply With Quote