@@ -37,14 +37,14 @@ extern "C"
3737{
3838#endif
3939
40- int calculate_os_thread_priority (
40+ rcutils_ret_t calculate_os_thread_priority (
4141 const int thread_priority ,
4242 int * os_priority )
4343{
4444#ifdef _WIN32
45- return false ;
45+ return RCUTILS_RET_ERROR ;
4646#elif __APPLE__
47- return false ;
47+ return RCUTILS_RET_ERROR ;
4848#else
4949 if (thread_priority == THREAD_PRIORITY_HIGH ) {
5050 * os_priority = sched_get_priority_max (SCHED_FIFO );
@@ -56,26 +56,27 @@ int calculate_os_thread_priority(
5656 * os_priority =
5757 (sched_get_priority_min (SCHED_FIFO ) + sched_get_priority_max (SCHED_FIFO )) / 2 - 1 ;
5858 } else { // unhandled priority
59- return 0 ;
59+ return RCUTILS_RET_ERROR ;
6060 }
61- return 1 ;
61+ return RCUTILS_RET_OK ;
6262#endif
6363}
6464
65- int configure_native_realtime_thread (
65+ rcutils_ret_t configure_native_realtime_thread (
6666 unsigned long int native_handle , const int priority ,
6767 const unsigned int cpu_bitmask )
6868{
6969 int success = 1 ;
7070#ifdef _WIN32
71- return false ;
71+ return RCUTILS_RET_ERROR ;
7272#elif __APPLE__
73- return false ;
73+ return RCUTILS_RET_ERROR ;
7474#else // POSIX systems
7575 struct sched_param params ;
7676 int policy ;
7777 success &= (pthread_getschedparam (native_handle , & policy , & params ) == 0 );
78- success &= calculate_os_thread_priority (priority , & params .sched_priority );
78+ success &= (calculate_os_thread_priority (priority , & params .sched_priority ) ==
79+ RCUTILS_RET_OK ? 1 : 0 );
7980 success &= (pthread_setschedparam (native_handle , SCHED_FIFO , & params ) == 0 );
8081
8182#ifdef __QNXNTO__
@@ -104,7 +105,7 @@ int configure_native_realtime_thread(
104105#endif // __QNXNTO__
105106#endif
106107
107- return success ;
108+ return success ? RCUTILS_RET_OK : RCUTILS_RET_ERROR ;
108109}
109110
110111#ifdef __cplusplus
0 commit comments