lkml.org 
[lkml]   [2013]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] posix_cpu_timers: fix timer never expires when executes clock_nanosleep
Hi Stanislaw,

Thansk for your info.

On Thu, Aug 01, 2013 at 01:30:50PM +0200, Stanislaw Gruszka wrote:
> Hi Dong Zhu
>
> On Thu, Aug 01, 2013 at 06:10:19PM +0800, Dong Zhu wrote:
> > diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
> > index c7f31aa..cc03290 100644
> > --- a/kernel/posix-cpu-timers.c
> > +++ b/kernel/posix-cpu-timers.c
> > @@ -1413,9 +1413,9 @@ static int posix_cpu_nsleep(const clockid_t which_clock, int flags,
> > /*
> > * Diagnose required errors first.
> > */
> > - if (CPUCLOCK_PERTHREAD(which_clock) &&
> > - (CPUCLOCK_PID(which_clock) == 0 ||
> > - CPUCLOCK_PID(which_clock) == current->pid))
> > + if (CPUCLOCK_PID(which_clock) == current->pid ||
> > + (CPUCLOCK_PERTHREAD(which_clock) &&
> > + CPUCLOCK_PID(which_clock) == 0))
> > return -EINVAL;
>
> Nope, this is wrong. We have to allow own pid process clock, because it
> can be used correctly on multi-threaded processes. Own tid thread clock

Yes, you are right, I really neglected this point.

> has no sense and we correctly return -EINVAL in such case.

>
> We could possibly add check for own pid together with check if process
> consist of one thread, but that is too complicated IMHO especially
> taking into account that threads on the process can be destroyed and
> created dynamically.
>

Agree, really so complicated.

--
Best Regards,
Dong Zhu


\
 
 \ /
  Last update: 2013-08-01 16:01    [W:0.049 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site