I checked that gettimeofday is thread-safe. However when I tried to analyze my program with helgrind, I got following report. Please fix this or suppress it by default. ==23482== Possible data race during write of size 8 at 0x9218A0 by thread #1 ==23482== Locks held: none ==23482== at 0x3803BCCC: vgPlain_amd64_linux_REDIR_FOR_vgettimeofday (m_trampoline.S:178) ==23482== by 0x5FFD7A9: gettimeofday (in /lib64/libc-2.12.so) ==23482== [remaining part of stack was here] ==23482== ==23482== This conflicts with a previous write of size 8 by thread #2 ==23482== Locks held: 1, at address 0x912D80 ==23482== at 0x3803BCCC: vgPlain_amd64_linux_REDIR_FOR_vgettimeofday (m_trampoline.S:178) ==23482== by 0x5FFD7A9: gettimeofday (in /lib64/libc-2.12.so) ==23482== [remaining part of stack was here] ==23482== Address 0x9218a0 is 0 bytes inside data symbol "func"
Why do you think this is a Valgrind issue and not an issue in your application?
This finally turned out to be a bug on my side. I am closing this as invalid.