source: rtems/cpukit/score/src/schedulercbsdetachthread.c

Last change on this file was 9278f3d, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 27, 2020 at 4:21:23 PM

score: Canonicalize Doxygen @file comments

Use common phrases for the file brief descriptions.

Update #3706.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSScoreSchedulerCBS
5 *
6 * @brief This source file contains the implementation of
7 *   _Scheduler_CBS_Detach_thread().
8 */
9
10/*
11 *  Copyright (C) 2011 Petr Benes.
12 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/score/schedulercbsimpl.h>
24#include <rtems/score/threadimpl.h>
25
26int _Scheduler_CBS_Detach_thread (
27  Scheduler_CBS_Server_id server_id,
28  rtems_id                task_id
29)
30{
31  Scheduler_CBS_Server *server;
32  ISR_lock_Context      lock_context;
33  Thread_Control       *the_thread;
34  Scheduler_CBS_Node   *node;
35
36  if ( server_id >= _Scheduler_CBS_Maximum_servers ) {
37    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
38  }
39
40  server = &_Scheduler_CBS_Server_list[ server_id ];
41
42  if ( !server->initialized ) {
43    return SCHEDULER_CBS_ERROR_NOSERVER;
44  }
45
46  if ( server->task_id != task_id ) {
47    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
48  }
49
50  the_thread = _Thread_Get( task_id, &lock_context );
51
52  if ( the_thread == NULL ) {
53    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
54  }
55
56  node = _Scheduler_CBS_Thread_get_node( the_thread );
57  node->cbs_server = NULL;
58
59  server->task_id = -1;
60
61  the_thread->budget_algorithm = the_thread->Start.budget_algorithm;
62  the_thread->budget_callout   = the_thread->Start.budget_callout;
63  the_thread->is_preemptible   = the_thread->Start.is_preemptible;
64
65  _ISR_lock_ISR_enable( &lock_context );
66  return SCHEDULER_CBS_OK;
67}
Note: See TracBrowser for help on using the repository browser.