This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Defining a thread with a K_FOREVER dealy will cause a compile error

According to Zephyr documentation it is possible to define a thread with K_FOREVER delay so it will not start till k_thread_start is called

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/0.3.0/zephyr/api/kernel_api.html?highlight=k_thread_start#_CPPv314k_thread_start7k_tid_t

However, if a thread is define with K_FOREVER will trigger the following compile issue:

K_THREAD_DEFINE(spis_tid, SPIS_STACK_SIZE, spis_thread, NULL, NULL, NULL,
		SPIS_PRIORITY, 0, K_FOREVER);

    incompatible types when initializing type 'int' using type 'k_timeout_t' {aka 'struct <anonymous>'}
    in expansion of macro 'Z_THREAD_INITIALIZER'
    in expansion of macro 'K_THREAD_DEFINE'
    In function 'spi_test_transceive':
    unused variable 'tx' [-Wunused-variable]
Build failed

Parents Reply Children
Related