MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / lwp_setaffinity

Function lwp_setaffinity

components/lwp/lwp_pid.c:2270–2282  ·  view source on GitHub ↗

* @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 */

Source from the content-addressed store, hash-verified

2268 * @note wrapper function for _lwp_setaffinity
2269 */
2270int 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/**

Callers 2

cmd_cpu_bindFunction · 0.85
sys_sched_setaffinityFunction · 0.85

Calls 1

_lwp_setaffinityFunction · 0.85

Tested by

no test coverage detected