strace内容解析:
1226 16:49:07.930478 futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
1225 16:49:07.930878 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1226 16:49:07.931055 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1225 16:49:07.931258 <... futex resumed>) = 0
1226 16:49:07.931420 <... futex resumed>) = 0
1226 16:49:07.931672 futex(0x7a27d750, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
1225 16:49:07.931831 _newselect(1, NULL, NULL, NULL, {tv_sec=0, tv_usec=10000}) = 0 (Timeout)
1225 16:49:07.942417 futex(0x7a27d750, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1226 16:49:07.942701 <... futex resumed>) = 0
1225 16:49:07.942815 <... futex resumed>) = 1
1226 16:49:07.942938 futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
1225 16:49:07.943089 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1226 16:49:07.943253 <... futex resumed>) = 0
1225 16:49:07.943357 <... futex resumed>) = 1
1226 16:49:07.943478 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1) = 0
1225 16:49:07.943714 _newselect(1, NULL, NULL, NULL, {tv_sec=0, tv_usec=10000} <unfinished ...>
1226 16:49:07.943877 futex(0x7a27d754, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
1603 16:49:07.948246 <... _newselect resumed>) = 0 (Timeout)
1603 16:49:07.948419 _newselect(1, NULL, NULL, NULL, {tv_sec=0, tv_usec=100000} <unfinished ...>
1225 16:49:07.954114 <... _newselect resumed>) = 0 (Timeout)
1225 16:49:07.954315 futex(0x7a27d754, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1226 16:49:07.954571 <... futex resumed>) = 0
unfinished表示系统调用未完成,后面肯定有一条resumed, Man中解释:
If a system call is being executed and meanwhile another one is being called from a different thread/process then strace will try to preserve the order of those events and mark the ongoing call as being unfinished. When the call returns it will be marked as resumed. example futex: 1226 16:49:07.942938 futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...> -------- futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2) 未完成 1225 16:49:07.943089 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1 <unfinished ...> -------- futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1) 未完成 1226 16:49:07.943253 <... futex resumed>) = 0 -------- futex WAIT完成,返回0 1225 16:49:07.943357 <... futex resumed>) = 1 -------- futex WAKE完成,返回1, 表示只唤醒一个; 1226 16:49:07.943478 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1) = 0 -------- futex WAKE完成,返回0,无唤醒进程; RETURN VALUE In the event of an error, all operations return -1, and set errno to indicate the error. The return value on success depends on the operation, as described in the following list: FUTEX_WAIT Returns 0 if the process was woken by a FUTEX_WAKE call. See ERRORS for the various possible error returns. FUTEX_WAKE Returns the number of processes woken up.
1226 16:49:07.930478 futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
EAGAIN FUTEX_CMP_REQUEUE detected that the value pointed to by uaddr is not equal to the expected value val3. (This probably indicates a race; use the safe FUTEX_WAKE now.)
表示资源不可用,需要阻塞。