fatcodeguy
Programmer
Hi, I'm trying to resolve some synchronization issues with a multithreaded application I have and I've run into several solutions, and i'm unsure what to do.
For startes, I have several threads that will access a single Queue. So I have the following:
I think this works. Now what does the Queue.Synchronized(ByVal queue as Queue) method do? Should i do this as well? Or is it an alternative solution?
Finally, there's also the use of the Mutex object, which allows you to create a critical section managed by the object. Is there an advantage to using this altertative instead of the one(s) mentioned above?
Thanks for all the help!!
For startes, I have several threads that will access a single Queue. So I have the following:
Code:
SyncLock _resourceProcessQueue.SyncRoot
_resourceProcessQueue.Enqueue(newResource)
End SyncLock
I think this works. Now what does the Queue.Synchronized(ByVal queue as Queue) method do? Should i do this as well? Or is it an alternative solution?
Code:
Private _resourceProcessQueue As Queue = Queue.Synchronized(New Queue)
Finally, there's also the use of the Mutex object, which allows you to create a critical section managed by the object. Is there an advantage to using this altertative instead of the one(s) mentioned above?
Thanks for all the help!!