Damien Zammit, le dim. 04 avril 2021 00:00:56 +1100, a ecrit: > >> +acpi_status > >> +acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout) > >> +{ > >> + int i; > >> + > >> + if (!timeout) > >> + timeout = 1; > >> + > >> + for (i = 0; i < timeout; i++) { > >> + if (!sem_trywait(handle)) { > >> + return AE_OK; > > > > Is timeout really expected to be the number of *times* to try to take > > the semaphore? Isn't it rather a time value that you can rather pass to > > sem_timedwait? > > It was a cheap way to wait, yes, I cheated. Because sem_timedwait > expects an epoch and I didn't have time to implement it properly yet.
Then introduce a usleep() in the loop to actually wait for the given time, otherwise you may get spurious timeouts. Samuel