bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/5] libacpica: Add acpi_init


From: Samuel Thibault
Subject: Re: [PATCH 3/5] libacpica: Add acpi_init
Date: Sat, 3 Apr 2021 15:17:30 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Samuel Thibault, le sam. 03 avril 2021 15:09:47 +0200, a ecrit:
> 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.

(Note that clock_gettime(CLOCK_REALTIME) will exactly give you the
epoch, to which you just have to add the timeout)

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]