OSDN Git Service

Fix race condition in timer disarm/delete.
authorChristopher Ferris <cferris@google.com>
Tue, 21 Oct 2014 02:09:19 +0000 (19:09 -0700)
committerChristopher Ferris <cferris@google.com>
Wed, 22 Oct 2014 01:31:02 +0000 (18:31 -0700)
commit0724132c3263145f2a667f453a199d313a5b3d9f
tree4bf159213d27f805579fc8b9a5a5460d70df5a3d
parentc712ceeec4c15da8488c5ce143fcc6b0a02d74f3
Fix race condition in timer disarm/delete.

When setting a repeat timer using the SIGEV_THREAD mechanism, it's possible
that the callback can be called after the timer is disarmed or deleted.
This happens because the kernel can generate signals that the timer thread
will continue to handle even after the timer is supposed to be off.

Add two new tests to verify that disarming/deleting doesn't continue to
call the callback.

Modify the repeat test to finish more quickly than before.

Refactor the Counter implementation a bit.

Bug: 18039727
Change-Id: I73192c915cdacf608521b1792c54e5af14a34907
libc/bionic/posix_timers.cpp
tests/time_test.cpp