Jinoh Kang (@iamahuman) commented about dlls/ntdll/unix/virtual.c:
+ { + uintptr_t reg_values[128]; + size_t reg_count = ARRAY_SIZE( reg_values ); + uintptr_t sp; + + /* Request the thread's register pointer values to force the thread to go through a memory barrier */ + kret = p_thread_get_register_pointer_values( threads[i], &sp, ®_count, reg_values ); + /* This function always fails when querying Rosetta's exception handling thread, so we only treat + KERN_INSUFFICIENT_BUFFER_SIZE as an error, like .NET core does. */ + if (kret == KERN_INSUFFICIENT_BUFFER_SIZE) + goto fail; + + /* Deallocate thread reference once we're done with it */ + kret = mach_port_deallocate( mach_task_self(), threads[i++] ); + if (kret) + goto fail; Likewise, breaking out of loop seems unnecessary. We don't even have to fail, since the barrier operation itself isn't affected by this. If we want to do some error handling then `ERR()` logging should be enough.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/741#note_61470