Re: [LTP] [PATCH 2/2] open_posix_testsuite/../mq_timedsend/12-1: fix race

chrubis
2013-07-31T11:07:22Z

Hi!
> > > -#define INTHREAD 0
> > > -#define INMAIN 1
> > > +#define SAFE(op) \
> > > + do {\
> > > + if ((op) == -1) {\
> > > + perror("unexpected failure"); \
> > > + exit(PTS_UNRESOLVED); \
> > > + } \
> > > + } while (0)
> >
> > I do not like this approach, this does not tell what call has failed. It
> > would be really hard to figure out what exact line of code has failed
> > from the test error messages.
>
> True, I'll remove that. I took if from other testcase, so we may
> want to fix that one too (some day).

Agreed.

> > > -/* manual semaphore */
> > > -int sem;
> > > +/* variable to indicate how many times signal handler was called */
> > > +static volatile sig_atomic_t in_handler;
> > >
> > > -/* flag to indicate signal handler was called */
> > > -int in_handler;
> > > +/* errno returned by mq_timedsend() */
> > > +static volatile int mq_timedsend_errno = -1;
> > >
> > > -/* flag to indicate that errno was set to eintr when mq_timedsend()
> > > - * was interruped. */
> > > -int errno_eintr;
> > > +/* pipes to synchronize thread calling mq_timedsend */
> > > +static int pipefd_start[2];
> > > +static int pipefd_exit[2];
> >
> > What about using mutexes? (it's multithread application anyway).
>
> Pipes seemed like less typing, but I can change that.

It just looks strange to synchronize multithread application with pipes,
not that it's wrong...

--
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.