1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

tests&examples: use sizeof(stack) in thread_create

fixes #1392
This commit is contained in:
Ludwig Ortmann 2014-07-09 07:13:56 +02:00
parent 1518d6ac64
commit 06a86aef20
15 changed files with 39 additions and 21 deletions

View File

@ -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);
}

View File

@ -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,

View File

@ -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);

View File

@ -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);
}

View File

@ -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");

View File

@ -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,

View File

@ -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

View File

@ -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) {

View File

@ -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,

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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 */

View File

@ -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 */

View File

@ -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");