/[svn]/linuxsampler/trunk/src/common/Thread.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/Thread.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1221 by schoenebeck, Wed Jun 6 18:50:03 2007 UTC revision 1222 by persson, Sun Jun 10 06:54:54 2007 UTC
# Line 170  bool Thread::IsRunning() { Line 170  bool Thread::IsRunning() {
170  int Thread::SetSchedulingPriority() {  int Thread::SetSchedulingPriority() {
171  #if !defined(__APPLE__)  #if !defined(__APPLE__)
172      int policy;      int policy;
173      char* policyDescription = NULL;      const char* policyDescription = NULL;
174      if (isRealTime) { // becomes a RT thread      if (isRealTime) { // becomes a RT thread
175          policy = SCHED_FIFO;          policy = SCHED_FIFO;
176          policyDescription = "realtime";          policyDescription = "realtime";
# Line 181  int Thread::SetSchedulingPriority() { Line 181  int Thread::SetSchedulingPriority() {
181      // set selected scheduling policy and priority      // set selected scheduling policy and priority
182      struct sched_param schp;      struct sched_param schp;
183      memset(&schp, 0, sizeof(schp));      memset(&schp, 0, sizeof(schp));
184      if (this->PriorityMax == 1) {      if (isRealTime) { // it is not possible to change priority for the SCHED_OTHER policy
185          schp.sched_priority = sched_get_priority_max(policy) + this->PriorityDelta;          if (this->PriorityMax == 1) {
186      }              schp.sched_priority = sched_get_priority_max(policy) + this->PriorityDelta;
187      if (this->PriorityMax == -1) {          }
188          schp.sched_priority = sched_get_priority_min(policy) + this->PriorityDelta;          if (this->PriorityMax == -1) {
189                schp.sched_priority = sched_get_priority_min(policy) + this->PriorityDelta;
190            }
191      }      }
192      if (pthread_setschedparam(__thread_id, policy, &schp) != 0) {      if (pthread_setschedparam(__thread_id, policy, &schp) != 0) {
193          std::cerr << "Thread: WARNING, can't assign "          std::cerr << "Thread: WARNING, can't assign "

Legend:
Removed from v.1221  
changed lines
  Added in v.1222

  ViewVC Help
Powered by ViewVC