Update of /cvsroot/kernelloader/linux/testprograms/condtest
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25345
Modified Files:
condtest.c
Log Message:
Don't do pthread calls when error happened to have a cleaner log.
Index: condtest.c
===================================================================
RCS file: /cvsroot/kernelloader/linux/testprograms/condtest/condtest.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** condtest.c 21 Aug 2014 19:27:48 -0000 1.1
--- condtest.c 22 Aug 2014 09:44:21 -0000 1.2
***************
*** 24,46 ****
while(1) {
- pstate = __LINE__;
- rv = pthread_mutex_lock(&mutex);
- pstate = __LINE__;
- assert(rv == 0);
-
- pstate = __LINE__;
if (consumed == counter) {
! counter++;
! }
! pstate = __LINE__;
! rv = pthread_cond_signal(&cond);
! pstate = __LINE__;
! assert(rv == 0);
! pstate = __LINE__;
! rv = pthread_mutex_unlock(&mutex);
! pstate = __LINE__;
! assert(rv == 0);
}
pstate = __LINE__;
--- 24,50 ----
while(1) {
if (consumed == counter) {
! pstate = __LINE__;
! rv = pthread_mutex_lock(&mutex);
! pstate = __LINE__;
! assert(rv == 0);
! pstate = __LINE__;
! if (consumed == counter) {
! counter++;
! }
! pstate = __LINE__;
! rv = pthread_cond_signal(&cond);
! pstate = __LINE__;
! assert(rv == 0);
!
! pstate = __LINE__;
! rv = pthread_mutex_unlock(&mutex);
! pstate = __LINE__;
! assert(rv == 0);
! } else {
! pstate = __LINE__;
! }
}
pstate = __LINE__;
***************
*** 113,117 ****
c++;
! if ((c & 255) == 255) {
printf("Error detected: pstate line %u cstate line %u\n", pstate, cstate);
}
--- 117,121 ----
c++;
! if ((c & 15) == 15) {
printf("Error detected: pstate line %u cstate line %u\n", pstate, cstate);
}
***************
*** 120,124 ****
}
prev_counter = counter;
! usleep(10000);
}
--- 124,128 ----
}
prev_counter = counter;
! usleep(100000);
}
|