I recently asked a question about using volatile and was aimed at reading some very informative articles from Intel and others that discussed memory barriers and their use. After reading these articles, I became quite paranoid.
I have a 64-bit machine. Is memcpy safe in adjacent, non-overlapping memory areas from multiple threads? For example, let's say I have a buffer:
char buff[10];
Is it always safe for one memcpy stream in the first 5 bytes, and the second stream copies in the last 5 bytes?
My gut reaction (and some simple tests) show that it is absolutely safe, but I could not find the documentation anywhere, which could completely convince me.
source
share