memcpy() safety on adjacent memory regions
- by JaredC
I recently asked a question on using volatile and was directed to read some very informative articles from Intel and others discussing memory barriers and their uses. After reading these articles I have become quite paranoid though.
I have a 64-bit machine. Is it safe to memcpy into adjacent, non-overlapping regions of memory from multiple threads? For example, say I have a buffer:
char buff[10];
Is it always safe for one thread to memcpy into the first 5 bytes while a second thread copies into the last 5 bytes?
My gut reaction (and some simple tests) indicate that this is completely safe, but I have been unable to find documentation anywhere that can completely convince me.