summaryrefslogtreecommitdiff
path: root/nuttx/examples/ostest/sem.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/examples/ostest/sem.c')
-rw-r--r--nuttx/examples/ostest/sem.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/nuttx/examples/ostest/sem.c b/nuttx/examples/ostest/sem.c
index 73be6910e..f6e6ddbb5 100644
--- a/nuttx/examples/ostest/sem.c
+++ b/nuttx/examples/ostest/sem.c
@@ -144,6 +144,9 @@ void sem_test(void)
pthread_t waiter_thread1;
pthread_t waiter_thread2;
pthread_t poster_thread;
+#ifdef SDCC
+ pthread_addr_t result;
+#endif
struct sched_param sparam;
int prio_min;
int prio_max;
@@ -178,7 +181,7 @@ void sem_test(void)
printf("sem_test: Set thread 1 priority to %d\n", sparam.sched_priority);
}
- status = pthread_create(&waiter_thread1, &attr, waiter_func, (void*)1);
+ status = pthread_create(&waiter_thread1, &attr, waiter_func, (pthread_addr_t)1);
if (status != 0)
{
printf("sem_test: Error in thread 1 creation, status=%d\n", status);
@@ -202,7 +205,7 @@ void sem_test(void)
printf("sem_test: Set thread 2 priority to %d\n", sparam.sched_priority);
}
- status = pthread_create(&waiter_thread2, &attr, waiter_func, (void*)2);
+ status = pthread_create(&waiter_thread2, &attr, waiter_func, (pthread_addr_t)2);
if (status != 0)
{
printf("sem_test: Error in thread 2 creation, status=%d\n", status);
@@ -226,13 +229,19 @@ void sem_test(void)
printf("sem_test: Set thread 3 priority to %d\n", sparam.sched_priority);
}
- status = pthread_create(&poster_thread, &attr, poster_func, (void*)3);
+ status = pthread_create(&poster_thread, &attr, poster_func, (pthread_addr_t)3);
if (status != 0)
{
printf("sem_test: Error in thread 3 creation, status=%d\n", status);
}
+#ifdef SDCC
+ pthread_join(waiter_thread1, &result);
+ pthread_join(waiter_thread2, &result);
+ pthread_join(poster_thread, &result);
+#else
pthread_join(waiter_thread1, NULL);
pthread_join(waiter_thread2, NULL);
pthread_join(poster_thread, NULL);
+#endif
}