Basically the question is in the title. If I have an array of structs, will Buffer.BlockCopy behave properly in multithreaded environment? In other words, what will happen if during execution of Buffer.BlockCopy some thread tries to update a field on one of the stored structs? http://msdn.microsoft.com/en-us/library/teyhh36d.aspx documentation says static methods of Buffer (BlockCopy is static) are guaranteed to be thread-safe for simple types. But if my struct contains only simple types, can this guarantee stretch a little bit into my favor?
Share
Buffer.BlockCopyis not an atomic operation on it’s own. There’s nothing stopping any other threads from either modifying fields of items in the array the array itself while theBlockCopyis being performed.