race condition fix (win tun)

This commit is contained in:
jeka committed 2026-03-07 12:21:01 +03:00
1 parent 5dfd1ea5fe
commit 5d4cef0c3e
6 files changed
+32 -7

No files matched your search

+13
View File
@@ -1426,6 +1426,19 @@ void uasync_get_stats(struct UASYNC* ua, size_t* timer_alloc, size_t* timer_u_fr
if (socket_u_free) *socket_u_free = ua->socket_free_count;
}
void uasync_memsync(struct UASYNC* ua) {
#ifdef _WIN32
EnterCriticalSection(&ua->posted_lock);
#else
pthread_mutex_lock(&ua->posted_lock);
#endif
#ifdef _WIN32
LeaveCriticalSection(&ua->posted_lock);
#else
pthread_mutex_unlock(&ua->posted_lock);
#endif
}
void uasync_post(struct UASYNC* ua, uasync_post_callback_t callback, void* arg) {
if (!ua || !callback) return;