Let's say that I have a module that has a Queue in it.
For other entities to Enqueue, 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 am under the impression that there is only one copy of the instructions in memory necessary to perform the InsertIntoQueue() function... which would lead me to think that this is thread safe.
However, I wonder what happens when two threads attempt to run the function at the same time?
Is this thread safe, and if not, how can I make it thread safe? (and What would be the performance implications regarding speed and memory usage)
Thanks in advance for your time.