summary refs log tree commit diff
path: root/include/compat/pthread.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2026-06-01 14:38:30 -0400
committerJune McEnroe <june@causal.agency>2026-06-01 14:38:30 -0400
commitea9a686c1d3f4d7e8e80a907629149ce79b1964a (patch)
tree3bdfd8bbfc03aea5816109a1919fc39177f13885 /include/compat/pthread.h
parentImport LibreSSL 3.8.2 (diff)
downloadlibretls-ea9a686c1d3f4d7e8e80a907629149ce79b1964a.tar.gz
libretls-ea9a686c1d3f4d7e8e80a907629149ce79b1964a.zip
Import LibreSSL 3.8.3
Diffstat (limited to 'include/compat/pthread.h')
-rw-r--r--[-rwxr-xr-x]include/compat/pthread.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/compat/pthread.h b/include/compat/pthread.h
index 1ab011c..8211dda 100755..100644
--- a/include/compat/pthread.h
+++ b/include/compat/pthread.h
@@ -30,20 +30,25 @@ struct pthread_once {
 };
 typedef struct pthread_once pthread_once_t;
 
+struct _pthread_win32_cb_arg {
+	void (*cb)(void);
+};
+
 static inline BOOL CALLBACK
 _pthread_once_win32_cb(PINIT_ONCE once, PVOID param, PVOID *context)
 {
-	void (*cb) (void) = param;
-	cb();
+	struct _pthread_win32_cb_arg *arg = param;
+	arg->cb();
 	return TRUE;
 }
 
 static inline int
 pthread_once(pthread_once_t *once, void (*cb) (void))
 {
-	BOOL rc = InitOnceExecuteOnce(&once->once, _pthread_once_win32_cb, cb, NULL);
+	struct _pthread_win32_cb_arg arg = { .cb = cb };
+	BOOL rc = InitOnceExecuteOnce(&once->once, _pthread_once_win32_cb, &arg, NULL);
 	if (rc == 0)
-		return -1;
+		return EINVAL;
 	else
 		return 0;
 }