"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "stress-pthread.c" between
stress-ng-0.09.52.tar.xz and stress-ng-0.09.54.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

stress-pthread.c  (stress-ng-0.09.52.tar.xz):stress-pthread.c  (stress-ng-0.09.54.tar.xz)
skipping to change at line 206 skipping to change at line 206
} }
/* /*
* stress_pthread() * stress_pthread()
* stress by creating pthreads * stress by creating pthreads
*/ */
static int stress_pthread(const args_t *args) static int stress_pthread(const args_t *args)
{ {
bool ok = true; bool ok = true;
bool locked = false; bool locked = false;
bool try_unlock = true;
uint64_t limited = 0, attempted = 0; uint64_t limited = 0, attempted = 0;
uint64_t pthread_max = DEFAULT_PTHREAD; uint64_t pthread_max = DEFAULT_PTHREAD;
int ret; int ret;
pthread_args_t pargs = { args, NULL }; pthread_args_t pargs = { args, NULL };
#if defined(SIGUSR2) #if defined(SIGUSR2)
if (stress_sighandler(args->name, SIGUSR2, SIG_IGN, NULL) < 0) if (stress_sighandler(args->name, SIGUSR2, SIG_IGN, NULL) < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
#endif #endif
skipping to change at line 299 skipping to change at line 300
locked = true; locked = true;
} }
all_running = (pthread_count == i); all_running = (pthread_count == i);
if (locked) { if (locked) {
ret = pthread_mutex_unlock(&mutex); ret = pthread_mutex_unlock(&mutex);
if (ret) { if (ret) {
pr_fail("%s pthread_mutex_unlock failed ( parent), errno=%d (%s)", pr_fail("%s pthread_mutex_unlock failed ( parent), errno=%d (%s)",
args->name, ret, strerror(ret)); args->name, ret, strerror(ret));
ok = false; ok = false;
/* We failed to unlock, so don't try agai
n on reap */
try_unlock = false;
goto reap; goto reap;
} }
locked = false; locked = false;
} }
if (all_running) if (all_running)
break; break;
} }
if (!locked) { if (!locked) {
skipping to change at line 334 skipping to change at line 337
} }
#endif #endif
thread_terminate = true; thread_terminate = true;
ret = pthread_cond_broadcast(&cond); ret = pthread_cond_broadcast(&cond);
if (ret) { if (ret) {
pr_fail("%s pthread_cond_broadcast failed (parent), errno =%d (%s)", pr_fail("%s pthread_cond_broadcast failed (parent), errno =%d (%s)",
args->name, ret, strerror(ret)); args->name, ret, strerror(ret));
ok = false; ok = false;
/* fall through and unlock */ /* fall through and unlock */
} }
if (locked) { if (locked && try_unlock) {
ret = pthread_mutex_unlock(&mutex); ret = pthread_mutex_unlock(&mutex);
if (ret) { if (ret) {
pr_fail("%s pthread_mutex_unlock failed (parent), errno=%d (%s)", pr_fail("%s pthread_mutex_unlock failed (parent), errno=%d (%s)",
args->name, ret, strerror(ret)); args->name, ret, strerror(ret));
ok = false; ok = false;
} else { } else {
locked = false; locked = false;
} }
} }
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
 End of changes. 3 change blocks. 
1 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)