4.115
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Scheduler CBS Destroy Server |
---|
5 | * |
---|
6 | * @ingroup ScoreScheduler |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (C) 2011 Petr Benes. |
---|
11 | * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <rtems/system.h> |
---|
23 | #include <rtems/config.h> |
---|
24 | #include <rtems/score/scheduler.h> |
---|
25 | #include <rtems/score/schedulercbs.h> |
---|
26 | |
---|
27 | int _Scheduler_CBS_Destroy_server ( |
---|
28 | Scheduler_CBS_Server_id server_id |
---|
29 | ) |
---|
30 | { |
---|
31 | int ret = SCHEDULER_CBS_OK; |
---|
32 | rtems_id tid; |
---|
33 | |
---|
34 | if ( server_id >= _Scheduler_CBS_Maximum_servers ) |
---|
35 | return SCHEDULER_CBS_ERROR_INVALID_PARAMETER; |
---|
36 | |
---|
37 | if ( !_Scheduler_CBS_Server_list[server_id] ) |
---|
38 | return SCHEDULER_CBS_ERROR_NOSERVER; |
---|
39 | |
---|
40 | if ( (tid = _Scheduler_CBS_Server_list[server_id]->task_id) != -1 ) |
---|
41 | ret = _Scheduler_CBS_Detach_thread ( server_id, tid ); |
---|
42 | |
---|
43 | _Workspace_Free( _Scheduler_CBS_Server_list[server_id] ); |
---|
44 | _Scheduler_CBS_Server_list[server_id] = NULL; |
---|
45 | return ret; |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.