source: rtems/cpukit/score/src/schedulercbsattachthread.c @ 2d7ae960

4.115
Last change on this file since 2d7ae960 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  Copyright (C) 2011 Petr Benes.
3 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#if HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <rtems/system.h>
15#include <rtems/config.h>
16#include <rtems/score/scheduler.h>
17#include <rtems/score/schedulercbs.h>
18#include <rtems/rtems/object.h>
19
20int _Scheduler_CBS_Attach_thread (
21  Scheduler_CBS_Server_id server_id,
22  rtems_id                task_id
23)
24{
25  Objects_Locations location;
26  Thread_Control *the_thread;
27  Scheduler_CBS_Per_thread *sched_info;
28
29  if ( server_id >= _Scheduler_CBS_Maximum_servers )
30    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
31
32  the_thread = _Thread_Get(task_id, &location);
33  /* The routine _Thread_Get may disable dispatch and not enable again. */
34  if ( the_thread )
35    _Thread_Enable_dispatch();
36  if ( !the_thread )
37    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
38
39  sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
40
41  /* Thread is already attached to a server. */
42  if ( sched_info->cbs_server )
43    return SCHEDULER_CBS_ERROR_FULL;
44
45  /* Server is not valid. */
46  if ( !_Scheduler_CBS_Server_list[server_id] )
47    return SCHEDULER_CBS_ERROR_NOSERVER;
48
49  /* Server is already attached to a thread. */
50  if ( _Scheduler_CBS_Server_list[server_id]->task_id != -1 )
51    return SCHEDULER_CBS_ERROR_FULL;
52
53  _Scheduler_CBS_Server_list[server_id]->task_id = task_id;
54  sched_info->cbs_server = (void *) _Scheduler_CBS_Server_list[server_id];
55
56  the_thread->budget_callout   = _Scheduler_CBS_Budget_callout;
57  the_thread->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT;
58  the_thread->is_preemptible   = true;
59
60  return SCHEDULER_CBS_OK;
61}
Note: See TracBrowser for help on using the repository browser.