* @brief Sets CPU affinity for a thread * * @param[in] tid The thread ID to set affinity for * @param[in] cpu The target CPU core number (0 to RT_CPUS_NR-1) * * @return int 0 on success, -1 on failure * * @note wrapper function for _lwp_setaffinity */
| 2268 | * @note wrapper function for _lwp_setaffinity |
| 2269 | */ |
| 2270 | int lwp_setaffinity(int tid, int cpu) |
| 2271 | { |
| 2272 | int ret; |
| 2273 | |
| 2274 | #ifdef RT_USING_SMP |
| 2275 | if (cpu < 0 || cpu > RT_CPUS_NR) |
| 2276 | { |
| 2277 | cpu = RT_CPUS_NR; |
| 2278 | } |
| 2279 | #endif |
| 2280 | ret = _lwp_setaffinity(tid, cpu); |
| 2281 | return ret; |
| 2282 | } |
| 2283 | |
| 2284 | #ifdef RT_USING_SMP |
| 2285 | /** |
no test coverage detected