Is the gettimeofday function thread safe in Linux?

后端 未结 4 2101
无人共我
无人共我 2020-12-17 23:00

The current time must be stored globally in order for gettimeofday to work, however I am not sure if the function modifies any global state so that concurrent execution is u

4条回答
  •  孤城傲影
    2020-12-17 23:57

    In glibc the gettimeofday(2) is a simple wrapper around a system call (it's a vsyscall actually). No data is touched in the userland. It is thread-safe.

提交回复
热议问题