This is a pretty basic question, and I imagine that it is, but I can't find any definitive answer. Is SynchronizationContext.Post()
threadsafe?
I have a member variable which holds the main thread's context, and _context.Post()
is being called from multiple threads. I imagine that Post()
could be called simultaneously on the object. Should I do something like
lock (_contextLock) _context.Post(myDelegate, myEventArgs);
or is that unnecessary?
Edit:
MSDN states that "Any instance members are not guaranteed to be thread safe." Should I keep my lock()
, then?