Hi,

I have a bunch of objects that need processing by a script.
What I'm doing now is the following:
- Storing them in a queue
- Letting the worker threads process them when they're available.

I'm doing that by dequeueing from a synchronized instance of the queue.
To quote the documentation:
To guarantee the thread safety of the Queue, all operations must be done through the wrapper returned by the Synchronized method.
But as I was afraid, it sometimes dequeues the same object twice.

So, questions:
1. Is myQueue.Dequeue() safe for usage without synchronization?
2. If not, is this the following the correct fix for my problem?
3. (if you have time) Could anyone explain to me what the lock() actually does?
Does it pause all other threads hitting the same block until that block is finished?
Code:
lock (this._instanceLock)
{
	entity = this._eventQueue.Dequeue();
}
As always, thanks for any input