Add timed_wait
Summary: Add try_wait_for and try_wait_until. Algorithm - We could use a doubly-linked list, but this would double the number of contended CAS for push/post. Instead, assume timeouts are infrequent, and just walk the list from the head to remove nodes. A lock bit is added to the head, which is taken only on timeout. We assume timeouts are infrequent. If a concurrent post() removes the node before the timeout can remove it, we must wait for the corresponding post() (but it is likely to arrive soon), instead of timing out. Reviewed By: magedm Differential Revision: D7167894 fbshipit-source-id: ea5242098d9ccd286a72fade6292223e95c44a81
Showing
Please register or sign in to comment