about summary refs log tree commit diff stats
path: root/src/libtools/threads32.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-09-14 10:26:38 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-09-14 10:26:38 +0200
commitde7baa0b410185710411f38d51bb29cbc0ebd92a (patch)
treefd728e9caab96475a2c66d5f614ef40f4015c7e3 /src/libtools/threads32.c
parentb361a0d2ffd11f12cc59757e86dc2e63c92dfdf3 (diff)
downloadbox64-de7baa0b410185710411f38d51bb29cbc0ebd92a.tar.gz
box64-de7baa0b410185710411f38d51bb29cbc0ebd92a.zip
[BOX32] Added (mostly untested) wrapped libGL and minimum SDL1 (SDLgears and zsnes works)
Diffstat (limited to 'src/libtools/threads32.c')
-rwxr-xr-xsrc/libtools/threads32.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libtools/threads32.c b/src/libtools/threads32.c
index e161ff45..5cc808a0 100755
--- a/src/libtools/threads32.c
+++ b/src/libtools/threads32.c
@@ -311,6 +311,18 @@ EXPORT int my32_pthread_rwlock_init(void* rdlock, void* attr)
 }
 EXPORT int my32___pthread_rwlock_init(void*, void*) __attribute__((alias("my32_pthread_rwlock_init")));
 
+EXPORT int my32_pthread_rwlock_destroy(void* rdlock)
+{
+	// the structure is bigger, but the "active" part should be the same size, so just save/restoore the padding at init
+	uint8_t buff[sizeof(pthread_rwlock_t)];
+	if(rdlock && sizeof(pthread_rwlock_t)>X86_RWLOCK_SIZE) {
+		memcpy(buff, rdlock+32, sizeof(pthread_rwlock_t)-X86_RWLOCK_SIZE);
+	}
+	int ret = pthread_rwlock_destroy(rdlock);
+	memcpy(rdlock+32, buff, sizeof(pthread_rwlock_t)-X86_RWLOCK_SIZE);
+	return ret;
+}
+
 EXPORT void my32___pthread_unwind_next(x64emu_t* emu, void* p)
 {
 	emu->quit = 1;