QSemaphore: emit waking on the same word size as we wait on

futexSemaphoreTryAcquire_loop() always waits on 32-bit portions of
QSemaphore. The current implementations only look at the pointer address
and don't care what size the waiter used. That's not the case for the
Darwin/macOS implementation:

In xnu/bsd/kern/sys_ulock.c:ulock_wake[1]:

	if (opcode != ull->ull_opcode) {
		ret = EDOM;
		goto out_ull_put;
	}

[1] 5c2921b07a/bsd/kern/sys_ulock.c (L970-L973)

Change-Id: I63b988479db546dabffcfffd1766c5eae61187f0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Thiago Macieira 2023-06-08 12:28:30 -07:00
parent 207954d5f0
commit 0f9894f79b

View File

@ -379,12 +379,9 @@ void QSemaphore::release(int n)
// its acquisition anyway, so it has to wait;
// 2) it did not see the new counter value, in which case its
// futexWait will fail.
if (futexHasWaiterCount) {
futexWakeAll(*futexLow32(&u));
futexWakeAll(*futexLow32(&u));
if (futexHasWaiterCount)
futexWakeAll(*futexHigh32(&u));
} else {
futexWakeAll(u);
}
}
return;
}