Skip to content

Commit 01ff501

Browse files
committed
[Memory64] pthread rwlock libc changes for 64-bit
1 parent c6c304a commit 01ff501

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

system/lib/libc/musl/src/thread/pthread_rwlock_timedwrlock.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rw, const struct times
55
#ifdef __EMSCRIPTEN__
66
/// XXX Emscripten: The spec allows detecting when multiple write locks would deadlock, which we do here to avoid hangs.
77
/// If attempting to lock the write lock that we already own, error out.
8-
if (rw->_rw_wr_owner == (int)pthread_self()) return EDEADLK;
8+
if (rw->_rw_wr_owner == (void *)pthread_self()) return EDEADLK;
99
#endif
1010
int r, t;
11-
11+
1212
r = pthread_rwlock_trywrlock(rw);
1313
if (r != EBUSY) return r;
14-
14+
1515
int spins = 100;
1616
while (spins-- && rw->_rw_lock && !rw->_rw_waiters) a_spin();
1717

@@ -27,7 +27,7 @@ int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rw, const struct times
2727
#ifdef __EMSCRIPTEN__
2828
/// XXX Emscripten: The spec allows detecting when multiple write locks would deadlock, which we do here to avoid hangs.
2929
/// Mark this thread as the owner of this write lock.
30-
rw->_rw_wr_owner = (int)pthread_self();
30+
rw->_rw_wr_owner = (void *)pthread_self();
3131
#endif
3232
return r;
3333
}

system/lib/libc/musl/src/thread/pthread_rwlock_trywrlock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
66
#ifdef __EMSCRIPTEN__
77
/// XXX Emscripten: The spec allows detecting when multiple write locks would deadlock, which we do here to avoid hangs.
88
/// Mark this thread to own the write lock, to ignore multiple attempts to lock.
9-
rw->_rw_wr_owner = (int)pthread_self();
9+
rw->_rw_wr_owner = (void *)pthread_self();
1010
#endif
1111
return 0;
1212
}

system/lib/libc/musl/src/thread/pthread_rwlock_unlock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rw)
77
#ifdef __EMSCRIPTEN__
88
/// XXX Emscripten: The spec allows detecting when multiple write locks would deadlock, which we do here to avoid hangs.
99
/// Mark this thread to not own the write lock anymore.
10-
if (rw->_rw_wr_owner == (int)pthread_self()) rw->_rw_wr_owner = 0;
10+
if (rw->_rw_wr_owner == (void *)pthread_self()) rw->_rw_wr_owner = 0;
1111
#endif
1212

1313
do {

0 commit comments

Comments
 (0)