Sorry for being too lazy to go check glibc sources, but does anybody know about memcpy() impementation on Linux glibc? I mean the following (i'm talking about 32-bit systems): integer assignments and readings are atomic operations, but what happens if I memcpy() integer (4 bytes)? Does memcpy() detect platform and optimizes itself so that it will do it in one pass (atomic) or will it do it byte by byte, and thus not being atomic?
EDIT: I mean, atomic integer read and atomic integer write (doesn't matter if context switch happens between read and write (in my case) but it does if it happens on writting half of integer.