Let's say that I have a module in which there is a queue.
For other Enqueue objects, they must go through a function:
public sub InsertIntoQueue(Obj)
MyQueue.Enqueue(Obj)
end sub
If I have multiple threads running and they want to call InsertIntoQueue (), is this considered thread safe?
I get the impression that only one copy of the instructions needed to execute the InsertIntoQueue () function is required in memory ... which would make me think that it is thread safe.
However, I wonder what happens when two threads try to run a function at the same time.
Is this thread safe, and if not, how can I make it thread safe? (and what would be the implications for memory performance and speed)
source
share