Is the gettimeofday function thread safe in Linux?

后端 未结 4 2102
无人共我
无人共我 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-18 00:00

    Yes, it is thread-safe. The only data it modifies is in the structures you pass pointers to, so an implementation that wasn't thread-safe would have to be doing something spooky.

    Best of luck on your project.

提交回复
热议问题