source: rtems/cpukit/score/src/schedulercbsdetachthread.c @ 4f5baff

4.115
Last change on this file since 4f5baff was d4d7899, checked in by Christopher Kerl <zargyyoyo@…>, on Nov 28, 2012 at 7:31:53 PM

score misc: Clean up Doxygen #2 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/7986213

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * @file
3 *
4 * @brief Detach from the CBS 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
27int _Scheduler_CBS_Detach_thread (
28  Scheduler_CBS_Server_id server_id,
29  rtems_id                task_id
30)
31{
32  Objects_Locations location;
33  Thread_Control *the_thread;
34  Scheduler_CBS_Per_thread *sched_info;
35
36  the_thread = _Thread_Get(task_id, &location);
37  /* The routine _Thread_Get may disable dispatch and not enable again. */
38  if ( the_thread ) {
39    _Thread_Enable_dispatch();
40  }
41
42  if ( server_id >= _Scheduler_CBS_Maximum_servers )
43    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
44  if ( !the_thread )
45    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
46  /* Server is not valid. */
47  if ( !_Scheduler_CBS_Server_list[server_id] )
48    return SCHEDULER_CBS_ERROR_NOSERVER;
49  /* Thread and server are not attached. */
50  if ( _Scheduler_CBS_Server_list[server_id]->task_id != task_id )
51    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
52
53  _Scheduler_CBS_Server_list[server_id]->task_id = -1;
54  sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
55  sched_info->cbs_server = NULL;
56
57  the_thread->budget_algorithm = the_thread->Start.budget_algorithm;
58  the_thread->budget_callout   = the_thread->Start.budget_callout;
59  the_thread->is_preemptible   = the_thread->Start.is_preemptible;
60
61  return SCHEDULER_CBS_OK;
62}
Note: See TracBrowser for help on using the repository browser.