Andrew Kryczka 61e324422e fix thread status synchronization in thread_list_test (#7825)
Summary:
The test was flaky because the BG threads could increase
`running_count_` up to `job_count_` before applying their thread status
updates. Then the test thread would see non-deterministic results when
counting threads with each status. The fix is to acquire mutex in test
thread so it sees `running_count_` and thread status updated atomically.
I think simply reordering the two updates would have been insufficient
since the thread status update uses `memory_order_relaxed`. This change
happens to also eliminate an undesirable sleep loop.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7825

Test Plan:
injected sleeps to verify the failure repros before this PR and does not
repro after.

Reviewed By: jay-zhuang

Differential Revision: D25742409

Pulled By: ajkr

fbshipit-source-id: 926a2223fe856e20bc4c0c27df6736ee5cb02c97
2021-01-04 10:46:24 -08:00
..
2017-07-15 16:11:23 -07:00
2020-10-28 23:22:27 -07:00
2020-04-20 13:24:25 -07:00
2020-11-10 23:42:13 -08:00
2020-10-01 09:23:04 -07:00
2020-04-20 13:24:25 -07:00
2020-07-09 14:35:17 -07:00
2020-07-09 14:35:17 -07:00
2020-10-28 23:22:27 -07:00
2017-07-15 16:11:23 -07:00
2020-08-21 15:48:52 -07:00
2020-10-01 09:23:04 -07:00
2020-10-28 23:22:27 -07:00