5
Last change
on this file since 2dd098a was
2dd098a,
checked in by Sebastian Huber <sebastian.huber@…>, on 10/31/16 at 07:33:11
|
score: Introduce Thread_Scheduler_control::home
Replace Thread_Scheduler_control::control and
Thread_Scheduler_control::own_control with new
Thread_Scheduler_control::home.
Update #2556.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[27270b0d] | 1 | /* |
---|
| 2 | * Copyright (c) 2014 embedded brains GmbH. All rights reserved. |
---|
| 3 | * |
---|
| 4 | * embedded brains GmbH |
---|
| 5 | * Dornierstr. 4 |
---|
| 6 | * 82178 Puchheim |
---|
| 7 | * Germany |
---|
| 8 | * <rtems@embedded-brains.de> |
---|
| 9 | * |
---|
| 10 | * The license and distribution terms for this file may be |
---|
| 11 | * found in the file LICENSE in this distribution or at |
---|
| 12 | * http://www.rtems.org/license/LICENSE. |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #if HAVE_CONFIG_H |
---|
| 16 | #include "config.h" |
---|
| 17 | #endif |
---|
| 18 | |
---|
| 19 | #include <rtems/rtems/tasks.h> |
---|
| 20 | #include <rtems/score/schedulerimpl.h> |
---|
| 21 | |
---|
| 22 | rtems_status_code rtems_task_get_scheduler( |
---|
[e5274df] | 23 | rtems_id task_id, |
---|
[27270b0d] | 24 | rtems_id *scheduler_id |
---|
| 25 | ) |
---|
| 26 | { |
---|
[ef6f8a83] | 27 | Thread_Control *the_thread; |
---|
| 28 | ISR_lock_Context lock_context; |
---|
| 29 | const Scheduler_Control *scheduler; |
---|
| 30 | |
---|
| 31 | if ( scheduler_id == NULL ) { |
---|
| 32 | return RTEMS_INVALID_ADDRESS; |
---|
| 33 | } |
---|
| 34 | |
---|
[e266d13] | 35 | the_thread = _Thread_Get( task_id, &lock_context ); |
---|
[ef6f8a83] | 36 | |
---|
| 37 | if ( the_thread == NULL ) { |
---|
[27270b0d] | 38 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ef6f8a83] | 39 | if ( _Thread_MP_Is_remote( task_id ) ) { |
---|
| 40 | return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; |
---|
[27270b0d] | 41 | } |
---|
[ef6f8a83] | 42 | #endif |
---|
| 43 | |
---|
| 44 | return RTEMS_INVALID_ID; |
---|
[27270b0d] | 45 | } |
---|
| 46 | |
---|
[ef6f8a83] | 47 | _Thread_State_acquire_critical( the_thread, &lock_context ); |
---|
| 48 | |
---|
[2dd098a] | 49 | scheduler = _Thread_Scheduler_get_home( the_thread ); |
---|
[ef6f8a83] | 50 | *scheduler_id = _Scheduler_Build_id( _Scheduler_Get_index( scheduler ) ); |
---|
| 51 | |
---|
| 52 | _Thread_State_release( the_thread, &lock_context ); |
---|
| 53 | return RTEMS_SUCCESSFUL; |
---|
[27270b0d] | 54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.