gvisor/pkg
Ghanan Gowripalan d057871f41 CancellableTimer to encapsulate the work of safely stopping timers
Add a new CancellableTimer type to encapsulate the work of safely stopping
timers when it fires at the same time some "related work" is being handled. The
term "related work" is some work that needs to be done while having obtained
some common lock (L).

Example: Say we have an invalidation timer that may be extended or cancelled by
some event. Creating a normal timer and simply cancelling may not be sufficient
as the timer may have already fired when the event handler attemps to cancel it.
Even if the timer and event handler obtains L before doing work, once the event
handler releases L, the timer will eventually obtain L and do some unwanted
work.

To prevent the timer from doing unwanted work, it checks if it should early
return instead of doing the normal work after obtaining L. When stopping the
timer callers must have L locked so the timer can be safely informed that it
should early return.

Test: Tests that CancellableTimer fires and resets properly. Test to make sure
the timer fn is not called after being stopped within the lock L.
PiperOrigin-RevId: 288806984
2020-01-08 17:50:54 -08:00
..
abi Implement rseq(2) 2020-01-06 11:42:44 -08:00
amutex Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
atomicbitops Enable pkg/atomicbitops support on arm64. 2019-10-09 03:09:52 +00:00
binary Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
bits Reorder BUILD license and load functions in gvisor. 2019-10-16 16:40:30 -07:00
bpf Reorder BUILD license and load functions in gvisor. 2019-10-16 16:40:30 -07:00
compressio Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
control Update canonical repository. 2019-06-13 16:50:15 -07:00
cpuid Add more extended features. 2019-11-11 14:42:57 -08:00
eventchannel Import and structure cleanup. 2019-11-21 11:41:30 -08:00
fd Cleanup host UDS support 2019-10-18 15:33:03 -07:00
fdchannel Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
fdnotifier Change syscall.EPOLLET to unix.EPOLLET 2019-08-05 23:10:08 +00:00
flipcall Import and structure cleanup. 2019-11-21 11:41:30 -08:00
fspath Clean up vfs.FilesystemImpl methods that operate on parent directories. 2019-12-23 13:18:39 -08:00
gate Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
ilist Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
linewriter Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
log Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
memutil Update canonical repository. 2019-06-13 16:50:15 -07:00
metric internal BUILD file cleanup. 2019-09-23 08:25:13 -07:00
p9 Remove useless comments from p9/handlers.go. 2019-12-16 16:32:59 -08:00
procid Update build tags to allow Go 1.14 2019-10-29 13:18:16 -07:00
rand Update canonical repository. 2019-06-13 16:50:15 -07:00
refs Reorder BUILD license and load functions in gvisor. 2019-10-16 16:40:30 -07:00
seccomp Enable runsc/boot support on arm64. 2019-11-13 06:39:11 +00:00
secio Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
segment Reorder BUILD license and load functions in gvisor. 2019-10-16 16:40:30 -07:00
sentry Return correct length with MSG_TRUNC for unix sockets. 2020-01-08 17:24:05 -08:00
sleep Update build tags to allow Go 1.14 2019-10-29 13:18:16 -07:00
state Import and structure cleanup. 2019-11-21 11:41:30 -08:00
syncutil Bump up Go 1.13 as minimum requirement 2019-12-06 23:10:15 -08:00
syserr netstack/udp: connect with the AF_UNSPEC address family means disconnect 2019-07-03 14:19:02 -07:00
syserror Clean up vfs.FilesystemImpl methods that operate on parent directories. 2019-12-23 13:18:39 -08:00
tcpip CancellableTimer to encapsulate the work of safely stopping timers 2020-01-08 17:50:54 -08:00
tmutex Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
unet Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
urpc Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
waiter Cleanup visibility. 2019-11-23 23:54:41 -08:00