Changeset f94e76ba in rtems


Ignore:
Timestamp:
07/28/99 18:03:20 (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
e112b63
Parents:
f28dfb36
Message:

Fix after this report from Peter Pointner <pr@…>:

Problem: a posix thread which is created by

pthread_attr_init(&tattr);
pthread_attr_setinheritsched(&tattr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy(&tattr, SCHED_RR);
pthread_create(&th, &tattr, func, arg);

has a first timeslice of 232 ticks (changing a running thread to
SCHED_RR id ok).

I use RTEMS-4.0.0. I am not sure if the problem exists in the current CVS
head revision. If it's not fixed, the patch at the end should do it.

Peter

--- pthreadcreate.c.orig Wed Jul 28 14:45:58 1999
+++ pthreadcreate.c Wed Jul 28 15:06:09 1999
@@ -199,6 +199,10 @@

api->schedpolicy = schedpolicy;
api->schedparam = schedparam;

+ if ( schedpolicy == SCHED_RR ) {
+ the_thread->cpu_time_budget = _Thread_Ticks_per_timeslice;
+ }
+

/*

  • This insures we evaluate the process-wide signals pending when we
  • first run.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/src/threadinitialize.c

    rf28dfb36 rf94e76ba  
    138138  the_thread->Start.budget_algorithm = budget_algorithm;
    139139  the_thread->Start.budget_callout   = budget_callout;
     140
     141  switch ( budget_algorithm ) {
     142    case THREAD_CPU_BUDGET_ALGORITHM_NONE:
     143    case THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE:
     144      break;
     145    case THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE:
     146      the_thread->cpu_time_budget = _Thread_Ticks_per_timeslice;
     147      break;
     148    case THREAD_CPU_BUDGET_ALGORITHM_CALLOUT:
     149      break;
     150  }
     151
    140152  the_thread->Start.isr_level        = isr_level;
    141153
  • cpukit/score/src/threadinitialize.c

    rf28dfb36 rf94e76ba  
    138138  the_thread->Start.budget_algorithm = budget_algorithm;
    139139  the_thread->Start.budget_callout   = budget_callout;
     140
     141  switch ( budget_algorithm ) {
     142    case THREAD_CPU_BUDGET_ALGORITHM_NONE:
     143    case THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE:
     144      break;
     145    case THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE:
     146      the_thread->cpu_time_budget = _Thread_Ticks_per_timeslice;
     147      break;
     148    case THREAD_CPU_BUDGET_ALGORITHM_CALLOUT:
     149      break;
     150  }
     151
    140152  the_thread->Start.isr_level        = isr_level;
    141153
Note: See TracChangeset for help on using the changeset viewer.