April 2012
Intermediate to advanced
352 pages
8h
English
Because callout functions execute asynchronously, it’s possible for a callout function to be called while another thread attempts to stop or reschedule it; thus creating a race condition. Fortunately, there are two simple solutions available for solving this problem:
callout_init_mtx, callout_init_rw, or callout_init(foo, 0)Callout functions associated with a lock are exempt from the race condition described above—as long as the associated lock is held before calling the callout management functions.
callout_drain to permanently cancel a callout functionUse callout_drain instead of callout_stop to permanently cancel a callout function. See, by waiting for the callout function to finish, you can’t destroy any ...