1818 * @file C++ Synchronization demo. Uses basic C++ functionality.
1919 */
2020
21- #define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
22- #include < misc/sys_log.h>
21+ #if defined(CONFIG_STDOUT_CONSOLE)
22+ #include < stdio.h>
23+ #define PRINT printf
24+ #else
25+ #include < misc/printk.h>
26+ #define PRINT printk
27+ #endif
2328
2429/* *
2530 * @class semaphore the basic pure virtual semaphore class
@@ -70,7 +75,7 @@ class task_semaphore: public semaphore {
7075 */
7176task_semaphore::task_semaphore (): _sema_internal(__K_SEMAPHORE_DEFAULT)
7277{
73- SYS_LOG_INF (" Create semaphore %p" , this );
78+ PRINT (" Create semaphore %p\n " , this );
7479 sema = (ksem_t )&_sema_internal;
7580}
7681
@@ -130,7 +135,7 @@ void hello_loop(const char *taskname,
130135 my_sem.wait ();
131136
132137 /* say "hello" */
133- SYS_LOG_INF (" %s: Hello World!" , taskname);
138+ PRINT (" %s: Hello World!\n " , taskname);
134139
135140 /* wait a while, then let other task have a turn */
136141 task_sleep (SLEEPTICKS);
@@ -195,7 +200,7 @@ class nano_semaphore: public semaphore {
195200 */
196201nano_semaphore::nano_semaphore ()
197202{
198- SYS_LOG_INF (" Create semaphore %p" , this );
203+ PRINT (" Create semaphore %p\n " , this );
199204 nano_sem_init (&_sema_internal);
200205}
201206
@@ -258,7 +263,7 @@ void fiber_entry(void)
258263 nano_sem_fiber.wait ();
259264
260265 /* say "hello" */
261- SYS_LOG_INF ( " Hello World!" );
266+ PRINT ( " %s: Hello World!\n " , __FUNCTION__ );
262267
263268 /* wait a while, then let task have a turn */
264269 nano_fiber_timer_start (&timer, SLEEPTICKS);
@@ -279,7 +284,7 @@ void main(void)
279284
280285 while (1 ) {
281286 /* say "hello" */
282- SYS_LOG_INF ( " Hello World!" );
287+ PRINT ( " %s: Hello World!\n " , __FUNCTION__ );
283288
284289 /* wait a while, then let fiber have a turn */
285290 nano_task_timer_start (&timer, SLEEPTICKS);
0 commit comments