Skip to content

Commit

Permalink
Fix hack in async write unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltabacaru committed Sep 12, 2022
1 parent 7c62329 commit 54b35d1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/object-store/realm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,12 +1177,10 @@ TEST_CASE("SharedRealm: async writes") {
auto write = db->start_write();
sema.add_stone();

// We want to wait until the main thread is waiting for the
// lock, which we can't do deterministically. If this sleep
// is too short the test will still pass and it'll just fail
// to test the intended code path.
std::chrono::milliseconds wait_time{500};
std::this_thread::sleep_for(wait_time);
// Wait until the main thread is waiting for the lock.
while (!db->waiting_for_write_lock()) {
millisleep(1);
}
write->close();
});

Expand Down

0 comments on commit 54b35d1

Please sign in to comment.