Skip to content

Commit

Permalink
Using auto
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Dec 10, 2023
1 parent f11d366 commit 28ab0a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/xtd.core.native.linux/src/xtd/native/linux/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ bool thread::set_current_thread_name(const std::string& name) {

bool thread::set_priority(intmax_t handle, int_least32_t priority) {
if (static_cast<pthread_t>(handle) == PTHREAD_FAILED) return false;
int_least32_t policy;
sched_param schedParam;
if (::pthread_getschedparam(static_cast<pthread_t>(handle), &policy, &schedParam) != 0)
auto policy = 0;
auto sched_param = ::sched_param {};
if (::pthread_getschedparam(static_cast<pthread_t>(handle), &policy, &sched_param) != 0)
return false;
schedParam.sched_priority = static_cast<int_least32_t>(ceil((static_cast<double>(priority) * (sched_get_priority_max(policy) - sched_get_priority_min(policy)) / 4) + sched_get_priority_min(policy)));
return pthread_setschedparam(static_cast<pthread_t>(handle), policy, &schedParam) == 0;

sched_param.sched_priority = static_cast<int_least32_t>(ceil((static_cast<double>(priority) * (sched_get_priority_max(policy) - sched_get_priority_min(policy)) / 4) + sched_get_priority_min(policy)));
return pthread_setschedparam(static_cast<pthread_t>(handle), policy, &sched_param) == 0;
}

void thread::sleep(int_least32_t milliseconds_timeout) {
Expand Down

0 comments on commit 28ab0a9

Please sign in to comment.