| 293 | } |
| 294 | |
| 295 | int |
| 296 | rte_thread_set_priority(rte_thread_t thread_id, |
| 297 | enum rte_thread_priority priority) |
| 298 | { |
| 299 | struct sched_param param; |
| 300 | int policy; |
| 301 | int ret; |
| 302 | |
| 303 | /* Realtime priority can cause crashes on non-Windows platforms. */ |
| 304 | if (priority == RTE_THREAD_PRIORITY_REALTIME_CRITICAL) |
| 305 | return ENOTSUP; |
| 306 | |
| 307 | ret = thread_map_priority_to_os_value(priority, ¶m.sched_priority, |
| 308 | &policy); |
| 309 | if (ret != 0) |
| 310 | return ret; |
| 311 | |
| 312 | return pthread_setschedparam((pthread_t)thread_id.opaque_id, policy, |
| 313 | ¶m); |
| 314 | } |
| 315 | |
| 316 | int |
| 317 | rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *)) |