Changeset 2014063 in rtems
- Timestamp:
- 08/07/96 22:06:08 (27 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 3fd3da4
- Parents:
- ecc912f4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/posix/src/pthread.c
recc912f4 r2014063 53 53 ) 54 54 { 55 unsigned32 ticks; 56 unsigned32 new_priority; 55 57 Thread_Control *the_thread; 56 58 POSIX_API_Control *api; … … 60 62 api = the_thread->API_Extensions[ THREAD_API_POSIX ]; 61 63 62 the_thread->cpu_time_budget = 63 _POSIX_Timespec_to_interval( &api->schedparam.ss_initial_budget ); 64 65 _Thread_Change_priority( 66 the_thread, 67 _POSIX_Priority_To_core( api->schedparam.sched_priority ) 68 ); 64 ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_initial_budget ); 65 66 if ( !ticks ) 67 ticks = 1; 68 69 the_thread->cpu_time_budget = ticks; 69 70 70 _Watchdog_Insert_ticks( 71 &api->Sporadic_timer, 72 _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period ) 73 ); 71 new_priority = _POSIX_Priority_To_core( api->ss_high_priority ); 72 the_thread->real_priority = new_priority; 73 74 if ( the_thread->resource_count == 0 || 75 the_thread->current_priority > new_priority ) 76 _Thread_Change_priority( the_thread, new_priority ); 77 78 ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period ); 79 80 if ( !ticks ) 81 ticks = 1; 82 83 _Watchdog_Insert_ticks( &api->Sporadic_timer, ticks ); 74 84 } 75 85 … … 83 93 ) 84 94 { 85 POSIX_API_Control *api; 86 87 api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; 88 89 /* XXX really should be based on MAX_U32 */ 90 91 the_thread->cpu_time_budget = 0xFFFFFFFF; 92 93 _Thread_Change_priority( 94 the_thread, 95 _POSIX_Priority_To_core( api->schedparam.ss_low_priority ) 96 ); 95 POSIX_API_Control *api; 96 unsigned32 new_priority; 97 98 api = the_thread->API_Extensions[ THREAD_API_POSIX ]; 99 100 /* 101 * This will prevent the thread from consuming its entire "budget" 102 * while at low priority. 103 */ 104 105 106 the_thread->cpu_time_budget = 0xFFFFFFFF; /* XXX should be based on MAX_U32 */ 107 108 new_priority = _POSIX_Priority_To_core( api->schedparam.ss_low_priority ); 109 the_thread->real_priority = new_priority; 110 111 if ( the_thread->resource_count == 0 || 112 the_thread->current_priority > new_priority ) 113 _Thread_Change_priority( the_thread, new_priority ); 97 114 } 98 115 … … 465 482 ) 466 483 { 467 if ( !attr || !attr->is_initialized )484 if ( !attr || !attr->is_initialized || !param ) 468 485 return EINVAL; 469 486 … … 482 499 ) 483 500 { 484 if ( !attr || !attr->is_initialized )501 if ( !attr || !attr->is_initialized || !param ) 485 502 return EINVAL; 486 503 … … 517 534 *policy = api->schedpolicy; 518 535 *param = api->schedparam; 536 param->sched_priority = 537 _POSIX_Priority_From_core( the_thread->current_priority ); 519 538 _Thread_Enable_dispatch(); 520 539 return 0; … … 619 638 620 639 case SCHED_SPORADIC: 640 api->ss_high_priority = api->schedparam.sched_priority; 621 641 _POSIX_Threads_Sporadic_budget_TSR( 0, the_thread ); 622 642 break; -
cpukit/posix/src/pthread.c
recc912f4 r2014063 53 53 ) 54 54 { 55 unsigned32 ticks; 56 unsigned32 new_priority; 55 57 Thread_Control *the_thread; 56 58 POSIX_API_Control *api; … … 60 62 api = the_thread->API_Extensions[ THREAD_API_POSIX ]; 61 63 62 the_thread->cpu_time_budget = 63 _POSIX_Timespec_to_interval( &api->schedparam.ss_initial_budget ); 64 65 _Thread_Change_priority( 66 the_thread, 67 _POSIX_Priority_To_core( api->schedparam.sched_priority ) 68 ); 64 ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_initial_budget ); 65 66 if ( !ticks ) 67 ticks = 1; 68 69 the_thread->cpu_time_budget = ticks; 69 70 70 _Watchdog_Insert_ticks( 71 &api->Sporadic_timer, 72 _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period ) 73 ); 71 new_priority = _POSIX_Priority_To_core( api->ss_high_priority ); 72 the_thread->real_priority = new_priority; 73 74 if ( the_thread->resource_count == 0 || 75 the_thread->current_priority > new_priority ) 76 _Thread_Change_priority( the_thread, new_priority ); 77 78 ticks = _POSIX_Timespec_to_interval( &api->schedparam.ss_replenish_period ); 79 80 if ( !ticks ) 81 ticks = 1; 82 83 _Watchdog_Insert_ticks( &api->Sporadic_timer, ticks ); 74 84 } 75 85 … … 83 93 ) 84 94 { 85 POSIX_API_Control *api; 86 87 api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; 88 89 /* XXX really should be based on MAX_U32 */ 90 91 the_thread->cpu_time_budget = 0xFFFFFFFF; 92 93 _Thread_Change_priority( 94 the_thread, 95 _POSIX_Priority_To_core( api->schedparam.ss_low_priority ) 96 ); 95 POSIX_API_Control *api; 96 unsigned32 new_priority; 97 98 api = the_thread->API_Extensions[ THREAD_API_POSIX ]; 99 100 /* 101 * This will prevent the thread from consuming its entire "budget" 102 * while at low priority. 103 */ 104 105 106 the_thread->cpu_time_budget = 0xFFFFFFFF; /* XXX should be based on MAX_U32 */ 107 108 new_priority = _POSIX_Priority_To_core( api->schedparam.ss_low_priority ); 109 the_thread->real_priority = new_priority; 110 111 if ( the_thread->resource_count == 0 || 112 the_thread->current_priority > new_priority ) 113 _Thread_Change_priority( the_thread, new_priority ); 97 114 } 98 115 … … 465 482 ) 466 483 { 467 if ( !attr || !attr->is_initialized )484 if ( !attr || !attr->is_initialized || !param ) 468 485 return EINVAL; 469 486 … … 482 499 ) 483 500 { 484 if ( !attr || !attr->is_initialized )501 if ( !attr || !attr->is_initialized || !param ) 485 502 return EINVAL; 486 503 … … 517 534 *policy = api->schedpolicy; 518 535 *param = api->schedparam; 536 param->sched_priority = 537 _POSIX_Priority_From_core( the_thread->current_priority ); 519 538 _Thread_Enable_dispatch(); 520 539 return 0; … … 619 638 620 639 case SCHED_SPORADIC: 640 api->ss_high_priority = api->schedparam.sched_priority; 621 641 _POSIX_Threads_Sporadic_budget_TSR( 0, the_thread ); 622 642 break;
Note: See TracChangeset
for help on using the changeset viewer.