diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-05 11:48:57 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-07 17:06:43 +0200 |
commit | 2d2352bab92c51c2fd857b9555242545bd08c95e (patch) | |
tree | de11a05e5b361a161e93c98866aa704ed24ed3ae /cpukit/score/src/schedulercbsdetachthread.c | |
parent | score: Add _Objects_Put_for_get_isr_disable() (diff) | |
download | rtems-2d2352bab92c51c2fd857b9555242545bd08c95e.tar.bz2 |
score: Add and use _Objects_Put()
Add and use _Objects_Put_without_thread_dispatch(). These two functions
pair with the _Objects_Get() function. This helps to introduce object
specific SMP locks to avoid lock contention.
Diffstat (limited to 'cpukit/score/src/schedulercbsdetachthread.c')
-rw-r--r-- | cpukit/score/src/schedulercbsdetachthread.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/cpukit/score/src/schedulercbsdetachthread.c b/cpukit/score/src/schedulercbsdetachthread.c index f4ce6029cc..cbc37eb195 100644 --- a/cpukit/score/src/schedulercbsdetachthread.c +++ b/cpukit/score/src/schedulercbsdetachthread.c @@ -34,16 +34,8 @@ int _Scheduler_CBS_Detach_thread ( Thread_Control *the_thread; Scheduler_CBS_Per_thread *sched_info; - the_thread = _Thread_Get(task_id, &location); - /* The routine _Thread_Get may disable dispatch and not enable again. */ - if ( the_thread ) { - _Thread_Enable_dispatch(); - } - if ( server_id >= _Scheduler_CBS_Maximum_servers ) return SCHEDULER_CBS_ERROR_INVALID_PARAMETER; - if ( !the_thread ) - return SCHEDULER_CBS_ERROR_INVALID_PARAMETER; /* Server is not valid. */ if ( !_Scheduler_CBS_Server_list[server_id] ) return SCHEDULER_CBS_ERROR_NOSERVER; @@ -51,13 +43,21 @@ int _Scheduler_CBS_Detach_thread ( if ( _Scheduler_CBS_Server_list[server_id]->task_id != task_id ) return SCHEDULER_CBS_ERROR_INVALID_PARAMETER; - _Scheduler_CBS_Server_list[server_id]->task_id = -1; - sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info; - sched_info->cbs_server = NULL; + the_thread = _Thread_Get(task_id, &location); + /* The routine _Thread_Get may disable dispatch and not enable again. */ + if ( the_thread ) { + _Scheduler_CBS_Server_list[server_id]->task_id = -1; + sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info; + sched_info->cbs_server = NULL; - the_thread->budget_algorithm = the_thread->Start.budget_algorithm; - the_thread->budget_callout = the_thread->Start.budget_callout; - the_thread->is_preemptible = the_thread->Start.is_preemptible; + the_thread->budget_algorithm = the_thread->Start.budget_algorithm; + the_thread->budget_callout = the_thread->Start.budget_callout; + the_thread->is_preemptible = the_thread->Start.is_preemptible; + + _Objects_Put( &the_thread->Object ); + } else { + return SCHEDULER_CBS_ERROR_INVALID_PARAMETER; + } return SCHEDULER_CBS_OK; } |