From: Jan S. <jst...@re...> - 2013-07-30 19:49:16
|
----- Original Message ----- > From: ch...@su... > To: "Jan Stancek" <jst...@re...> > Cc: ltp...@li... > Sent: Tuesday, 30 July, 2013 7:35:17 PM > Subject: Re: [LTP] [PATCH 2/2] open_posix_testsuite/../mq_timedsend/12-1: fix race > > 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). > > > -/* 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. Regards, Jan > > -- > Cyril Hrubis > ch...@su... > |