- if ( !(thread->sched_mode & TH_MODE_REALTIME) &&
- !(thread->safe_mode & TH_MODE_REALTIME) ) {
- if (!(thread->sched_mode & TH_MODE_FAILSAFE)) {
- integer_t oldmode = (thread->sched_mode & TH_MODE_TIMESHARE);
+ if ( (thread->sched_mode != TH_MODE_REALTIME) &&
+ (thread->saved_mode != TH_MODE_REALTIME) ) {
+ if (!(thread->sched_flags & TH_SFLAG_DEMOTED_MASK)) {
+ boolean_t oldmode = thread->sched_mode == TH_MODE_TIMESHARE;