0

I'm working in a Ubuntu virtual machine on vSphere. My application is waiting on a pthread signal (sem_t) every 1 second. when I strace the system call, find the system call is much quicker returned than 1 second. The result by strace is as below.

futex(0x7f4461035200, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, {1, 0}, ffffffff) = -1 ETIMEDOUT (Connection timed out)

Anyone knows the reason?

ptan
  • 169
  • 3
  • 9
  • FUTEX_WAIT_BITSET_PRIVATE = FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG. "FUTEX_PRIVATE_FLAG indicates that this shared futex variable is in a process. FUTEX_CLOCK_REALTIME changes the clock source from CLOCK_MONOTONIC to CLOCK_REALTIME. The difference between the two is that the user can change the current time (or more realistically, the ntpd daemon can). CLOCK_MONOTONIC is unaffected by these clock changes, whereas CLOCK_REALTIME is.", from [link](http://locklessinc.com/articles/futex_cheat_sheet/) – ptan Feb 04 '15 at 12:24
  • It's my stupid fault. sem_timedout uses an absolute timespec, not a relative time. – ptan Feb 04 '15 at 13:33

0 Answers0