Skip to content

Commit d80d15e

Browse files
majnemerGoogle-ML-Automation
authored andcommitted
Replace TSL's BlockingCounter with absl's.
PiperOrigin-RevId: 707214565
1 parent 2225cf1 commit d80d15e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

xla/tsl/platform/cloud/ram_file_block_cache_test.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ limitations under the License.
2222
#include "absl/time/time.h"
2323
#include "xla/tsl/lib/core/status_test_util.h"
2424
#include "xla/tsl/platform/cloud/now_seconds_env.h"
25-
#include "tsl/platform/blocking_counter.h"
2625
#include "tsl/platform/env.h"
27-
#include "tsl/platform/notification.h"
2826
#include "tsl/platform/test.h"
2927

3028
namespace tsl {
@@ -493,6 +491,10 @@ TEST(RamFileBlockCacheTest, ParallelReads) {
493491
char* buffer, size_t* bytes_transferred) {
494492
if (counter.DecrementCount()) {
495493
notification.Notify();
494+
// This call to `Wait()` is not expected to block. Calling `Wait()` here
495+
// allows us to satisfy `BlockingCounter`'s requirement: "When `Wait()`
496+
// returns, it is legal to destroy the `BlockingCounter`.".
497+
counter.Wait();
496498
}
497499
if (!notification.WaitForNotificationWithTimeout(absl::Seconds(10))) {
498500
// This avoids having the test time out, which is harder to debug.
@@ -524,7 +526,7 @@ TEST(RamFileBlockCacheTest, CoalesceConcurrentReads) {
524526
// Concurrent reads to the same file blocks should be de-duplicated.
525527
const size_t block_size = 16;
526528
int num_requests = 0;
527-
Notification notification;
529+
absl::Notification notification;
528530
auto fetcher = [&num_requests, &notification, block_size](
529531
const string& filename, size_t offset, size_t n,
530532
char* buffer, size_t* bytes_transferred) {

0 commit comments

Comments
 (0)