Skip to content

Commit 33ee1f8

Browse files
Yifan ZhuSchrodingerZhu
authored andcommitted
reduce waiting time
1 parent bb3cd9b commit 33ee1f8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libc/test/integration/src/pthread/pthread_rwlock_test.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ static void timedlock_with_deadlock_test() {
162162
timespec ts{};
163163
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlock_rdlock(&rwlock), 0);
164164
LIBC_NAMESPACE::clock_gettime(CLOCK_REALTIME, &ts);
165-
ts.tv_sec += 1;
165+
ts.tv_nsec += 50'000;
166+
if (ts.tv_nsec >= 1'000'000'000) {
167+
ts.tv_nsec -= 1'000'000'000;
168+
ts.tv_sec += 1;
169+
}
166170
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlock_timedwrlock(&rwlock, &ts),
167171
ETIMEDOUT);
168172
ASSERT_EQ(LIBC_NAMESPACE::pthread_rwlock_timedrdlock(&rwlock, &ts), 0);

0 commit comments

Comments
 (0)