Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libpthread fix uninitialized var.
details: https://anonhg.NetBSD.org/src/rev/9e5d0160b8cd
branches: trunk
changeset: 346313:9e5d0160b8cd
user: christos <christos%NetBSD.org@localhost>
date: Wed Jul 06 14:42:53 2016 +0000
description:
fix uninitialized var.
diffstat:
tests/lib/libpthread/t_mutex.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (66 lines):
diff -r 5dde13c337c6 -r 9e5d0160b8cd tests/lib/libpthread/t_mutex.c
--- a/tests/lib/libpthread/t_mutex.c Wed Jul 06 14:28:51 2016 +0000
+++ b/tests/lib/libpthread/t_mutex.c Wed Jul 06 14:42:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mutex.c,v 1.8 2016/07/03 14:24:59 christos Exp $ */
+/* $NetBSD: t_mutex.c,v 1.9 2016/07/06 14:42:53 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mutex.c,v 1.8 2016/07/03 14:24:59 christos Exp $");
+__RCSID("$NetBSD: t_mutex.c,v 1.9 2016/07/06 14:42:53 christos Exp $");
#include <pthread.h>
#include <stdio.h>
@@ -346,6 +346,7 @@
max_fifo_prio = sched_get_priority_max(SCHED_FIFO);
printf("min prio for FIFO = %d\n", min_fifo_prio);
param.sched_priority = min_fifo_prio;
+
/* = 0 OTHER, 1 FIFO, 2 RR, -1 NONE */
res = sched_setscheduler(getpid(), SCHED_FIFO, ¶m);
printf("previous policy used = %d\n", res);
@@ -389,9 +390,8 @@
ATF_REQUIRE_EQ(policy, 1);
printf("high prio = %d\n", param.sched_priority);
sleep(1);
- int i;
long tmp = 0;
- for (i = 0; i<20; i++) {
+ for (int i = 0; i < 20; i++) {
while (high_cnt < MAX_LOOP) {
tmp += (123456789 % 1234) * (987654321 % 54321);
high_cnt += 1;
@@ -422,9 +422,9 @@
ATF_REQUIRE_EQ(policy, 1);
printf("low prio = %d\n", param.sched_priority);
sleep(1);
+ long tmp = 0;
for (int i = 0; i < 20; i++) {
while (low_cnt < MAX_LOOP) {
- long tmp;
tmp += (123456789 % 1234) * (987654321 % 54321);
low_cnt += 1;
}
@@ -470,14 +470,16 @@
*/
ATF_TC_BODY(mutex6, tc)
{
+ struct sched_param param;
int res;
pthread_t high, low;
+
min_fifo_prio = sched_get_priority_min(SCHED_FIFO);
max_fifo_prio = sched_get_priority_max(SCHED_FIFO);
PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL));
printf("min_fifo_prio = %d, max_fifo_info = %d\n", min_fifo_prio,
max_fifo_prio);
- struct sched_param param;
+
param.sched_priority = min_fifo_prio;
res = sched_setscheduler(getpid(), SCHED_FIFO, ¶m);
printf("previous policy used = %d\n", res);
Home |
Main Index |
Thread Index |
Old Index