Browse Source

tests&examples: use sizeof(stack) in thread_create

fixes #1392
dev/timer
Ludwig Ortmann 9 years ago
parent
commit
06a86aef20
  1. 10
      examples/ccn-lite-client/main.c
  2. 2
      examples/default/main.c
  3. 5
      examples/rpl_udp/rpl.c
  4. 5
      examples/rpl_udp/udp.c
  5. 2
      tests/test_irq/main.c
  6. 2
      tests/test_mutex_unlock_and_sleep/main.c
  7. 5
      tests/test_nativenet/main.c
  8. 4
      tests/test_posix_semaphore/main.c
  9. 2
      tests/test_pthread_condition_variable/main.c
  10. 5
      tests/test_thread_basic/main.c
  11. 2
      tests/test_thread_cooperation/main.c
  12. 6
      tests/test_thread_msg/main.c
  13. 2
      tests/test_thread_msg_block_w_queue/main.c
  14. 2
      tests/test_thread_msg_block_wo_queue/main.c
  15. 6
      tests/test_thread_msg_seq/main.c

10
examples/ccn-lite-client/main.c

@ -78,7 +78,10 @@ static void riot_ccn_appserver(int argc, char **argv)
return;
}
appserver_pid = thread_create(appserver_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1, CREATE_STACKTEST, appserver_thread, "appserver");
appserver_pid = thread_create(
appserver_stack, sizeof(appserver_stack),
PRIORITY_MAIN - 1, CREATE_STACKTEST,
appserver_thread, "appserver");
DEBUG("ccn-lite appserver on thread_id %d...\n", appserver_pid);
}
#endif
@ -163,7 +166,10 @@ static void riot_ccn_relay_start(int argc, char **argv)
shell_threshold_aggregate = atoi(argv[3]);
}
relay_pid = thread_create(relay_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 2, CREATE_STACKTEST, relay_thread, "relay");
relay_pid = thread_create(
relay_stack, sizeof(relay_stack),
PRIORITY_MAIN - 2, CREATE_STACKTEST,
relay_thread, "relay");
DEBUG("ccn-lite relay on thread_id %d...\n", relay_pid);
}

2
examples/default/main.c

@ -88,7 +88,7 @@ void init_transceiver(void)
{
int radio_pid = thread_create(
radio_stack_buffer,
RADIO_STACK_SIZE,
sizeof(radio_stack_buffer),
PRIORITY_MAIN - 2,
CREATE_STACKTEST,
radio,

5
examples/rpl_udp/rpl.c

@ -87,7 +87,10 @@ void rpl_udp_init(int argc, char **argv)
}
DEBUGF("Start monitor\n");
int monitor_pid = thread_create(monitor_stack_buffer, MONITOR_STACK_SIZE, PRIORITY_MAIN - 2, CREATE_STACKTEST, rpl_udp_monitor, "monitor");
int monitor_pid = thread_create(
monitor_stack_buffer, sizeof(monitor_stack_buffer),
PRIORITY_MAIN - 2, CREATE_STACKTEST,
rpl_udp_monitor, "monitor");
DEBUGF("Register at transceiver %02X\n", TRANSCEIVER);
transceiver_register(TRANSCEIVER, monitor_pid);
ipv6_register_packet_handler(monitor_pid);

5
examples/rpl_udp/udp.c

@ -47,7 +47,10 @@ void udp_server(int argc, char **argv)
(void) argc;
(void) argv;
int udp_server_thread_pid = thread_create(udp_server_stack_buffer, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN, CREATE_STACKTEST, init_udp_server, "init_udp_server");
int udp_server_thread_pid = thread_create(
udp_server_stack_buffer, sizeof(udp_server_stack_buffer),
PRIORITY_MAIN, CREATE_STACKTEST,
init_udp_server, "init_udp_server");
printf("UDP SERVER ON PORT %d (THREAD PID: %d)\n", HTONS(SERVER_PORT), udp_server_thread_pid);
}

2
tests/test_irq/main.c

@ -49,7 +49,7 @@ int main(void)
{
busy = 1;
k = 23;
thread_create(busy_stack, KERNEL_CONF_STACKSIZE_MAIN,
thread_create(busy_stack, sizeof(busy_stack),
PRIORITY_MAIN + 1, CREATE_WOUT_YIELD, busy_thread,
"busy_thread");
puts("busy_thread created");

2
tests/test_mutex_unlock_and_sleep/main.c

@ -43,7 +43,7 @@ int main(void)
mutex_init(&mutex);
thread_create(stack,
KERNEL_CONF_STACKSIZE_MAIN,
sizeof(stack),
PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST,
second_thread,

5
tests/test_nativenet/main.c

@ -142,7 +142,10 @@ int main(void)
#ifndef SENDER
printf("\n\tmain(): starting radio thread\n");
radio_pid = thread_create(radio_stack_buffer, RADIO_STACK_SIZE, PRIORITY_MAIN - 2, CREATE_STACKTEST, radio, "radio");
radio_pid = thread_create(
radio_stack_buffer, sizeof(radio_stack_buffer),
PRIORITY_MAIN - 2, CREATE_STACKTEST,
radio, "radio");
transceiver_register(TRANSCEIVER_NATIVE, radio_pid);
#endif

4
tests/test_posix_semaphore/main.c

@ -61,7 +61,7 @@ static void test1(void)
}
puts("first: thread create");
int pid = thread_create(test1_thread_stack, KERNEL_CONF_STACKSIZE_MAIN,
int pid = thread_create(test1_thread_stack, sizeof(test1_thread_stack),
PRIORITY_MAIN - 1, CREATE_STACKTEST | CREATE_WOUT_YIELD,
test1_second_thread, "second");
@ -134,7 +134,7 @@ void test2(void)
snprintf(names[i], sizeof(names[i]), "priority %d", priority);
printf("first: thread create: %d\n", priority);
int pid = thread_create(test2_thread_stack[i],
KERNEL_CONF_STACKSIZE_MAIN, priority, CREATE_STACKTEST,
sizeof(test2_thread_stack[i]), priority, CREATE_STACKTEST,
priority_sema_thread, names[i]);
if (pid < 0) {

2
tests/test_pthread_condition_variable/main.c

@ -57,7 +57,7 @@ int main(void)
pthread_cond_init(&cv, NULL);
int pid = thread_create(stack,
KERNEL_CONF_STACKSIZE_MAIN,
sizeof(stack),
PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST,
second_thread,

5
tests/test_thread_basic/main.c

@ -34,7 +34,10 @@ void second_thread(void)
int main(void)
{
(void) thread_create(t2_stack, STACK_SIZE, PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST, second_thread, "nr2");
(void) thread_create(
t2_stack, sizeof(t2_stack),
PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
second_thread, "nr2");
puts("first thread\n");
return 0;
}

2
tests/test_thread_cooperation/main.c

@ -79,7 +79,7 @@ int main(void)
for (int i = 0; i < PROBLEM; ++i) {
printf("Creating thread with arg %d\n", (i + 1));
ths[i] = thread_create(stacks[i], STACK_SIZE, PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST, run, "thread");
ths[i] = thread_create(stacks[i], sizeof(stacks[i]), PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST, run, "thread");
if (ths[i] < 0) {
printf("[!!!] Creating thread failed with %d\n", err);

6
tests/test_thread_msg/main.c

@ -75,11 +75,11 @@ void thread3(void)
int main(void)
{
p1 = thread_create(t1_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread1, "nr1");
p2 = thread_create(t2_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
p2 = thread_create(t2_stack, sizeof(t2_stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread2, "nr2");
p3 = thread_create(t3_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
p3 = thread_create(t3_stack, sizeof(t3_stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread3, "nr3");
puts("THREADS CREATED\n");
return 0;

2
tests/test_thread_msg_block_w_queue/main.c

@ -55,7 +55,7 @@ int main(void)
msg_t msg_q[1];
msg_init_queue(msg_q, 1);
p1 = thread_create(t1_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread1, "nr1");
/* step 3: receive a msg */

2
tests/test_thread_msg_block_wo_queue/main.c

@ -52,7 +52,7 @@ int main(void)
msg_t msg;
p_main = sched_active_pid;
p1 = thread_create(t1_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, thread1, "nr1");
/* step 3: receive a msg */

6
tests/test_thread_msg_seq/main.c

@ -50,11 +50,11 @@ int main(void)
{
msg_t msg;
p1 = thread_create(t1_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
p1 = thread_create(t1_stack, sizeof(t1_stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, sub_thread, "nr1");
p2 = thread_create(t2_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
p2 = thread_create(t2_stack, sizeof(t2_stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, sub_thread, "nr2");
p3 = thread_create(t3_stack, KERNEL_CONF_STACKSIZE_MAIN, PRIORITY_MAIN - 1,
p3 = thread_create(t3_stack, sizeof(t3_stack), PRIORITY_MAIN - 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST, sub_thread, "nr3");
puts("THREADS CREATED\n");

Loading…
Cancel
Save