Source-Changes-D archive

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

Re: CVS commit: src/lib/libpthread



> In article <20130329032804.23B1514A2F2%mail.netbsd.org@localhost>,
> YAMAMOTO Takashi <yamt%mwd.biglobe.ne.jp@localhost> wrote:
>>
>>"mono" escaping its scope?
> 
> Yes, I already added it to lwp_park to avoid the hack but not using
> the syscall yet until we decide what we need to pass to lwp_park
> to avoid priority inversion and fix the races in pthread_cond_*.
> 
> christos

i meant the following code.
struct timespec mono will be used after the end of the block.
is it safe?

                if (pthread_cond_getclock(cond) == CLOCK_MONOTONIC) {
                        struct timespec mono, real;
                        if (clock_gettime(CLOCK_REALTIME, &real) == -1 ||
                            clock_gettime(CLOCK_MONOTONIC, &mono) == -1)
                                return errno;
                        timespecsub(abstime, &mono, &mono);
                        timespecadd(&mono, &real, &mono);
                        abstime = &mono;
                }



Home | Main Index | Thread Index | Old Index