• A
    Add SystemClock::TimedWait() function (#11753) · e373685d
    Andrew Kryczka 提交于
    Summary:
    Having a synthetic implementation of `TimedWait()` in `SystemClock` will allow us to add `SyncPoint`s while mutex is released, which was previously impossible since the lock was released and reacquired all within `pthread_cond_timedwait()`. Additionally, integrating `TimedWait()` with `MockSystemClock` allows us to cleanup some workarounds in the test code. In this PR I only cleaned up the `GenericRateLimiter` test workaround.
    
    This is related to the intended follow-up mentioned in https://github.com/facebook/rocksdb/issues/7101's description. There are a couple differences:
    
    (1) This PR does not include removing the particular workaround that initially motivated it. Actually, the `Timer` class uses `InstrumentedCondVar`, so the interface introduced here is inadequate to remove that workaround. On the bright side, the interface introduced in this PR can be changed as needed since it can neither be used nor extended externally, due to using forward-declared `port::CondVar*` in the interface.
    (2) This PR only makes the change in `SystemClock` not `Env`. Older revisions of this PR included `Env::TimedWait()` and `SpecialEnv::TimedWait()`; however, since they were unused it probably makes sense to defer adding them until when they are needed.
    
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/11753
    
    Reviewed By: pdillinger
    
    Differential Revision: D48654995
    
    Pulled By: ajkr
    
    fbshipit-source-id: 15e19f2454b64d4ec7f50e328691c66ca9911122
    e373685d
mock_time_env.h 3.7 KB