source: rtems/cpukit/rtems/src/ratemoncancel.c @ eaef4657

4.104.115
Last change on this file since eaef4657 was ebe61382, checked in by Joel Sherrill <joel.sherrill@…>, on 11/30/07 at 21:49:41

2007-11-30 Joel Sherrill <joel.sherrill@…>

  • rtems/src/barrierdelete.c, rtems/src/barrierrelease.c, rtems/src/barriertranslatereturncode.c, rtems/src/barrierwait.c, rtems/src/clockget.c, rtems/src/dpmemdelete.c, rtems/src/dpmemexternal2internal.c, rtems/src/dpmeminternal2external.c, rtems/src/eventsend.c, rtems/src/eventtimeout.c, rtems/src/msgqbroadcast.c, rtems/src/msgqdelete.c, rtems/src/msgqflush.c, rtems/src/msgqgetnumberpending.c, rtems/src/msgqreceive.c, rtems/src/msgqsend.c, rtems/src/msgqurgent.c, rtems/src/partdelete.c, rtems/src/partgetbuffer.c, rtems/src/partreturnbuffer.c, rtems/src/ratemoncancel.c, rtems/src/ratemondelete.c, rtems/src/ratemongetstatistics.c, rtems/src/ratemongetstatus.c, rtems/src/ratemonperiod.c, rtems/src/ratemonresetstatistics.c, rtems/src/ratemontimeout.c, rtems/src/semdelete.c, rtems/src/semflush.c, rtems/src/semobtain.c, rtems/src/semrelease.c, rtems/src/semtranslatereturncode.c, rtems/src/signalsend.c, rtems/src/taskdelete.c, rtems/src/taskgetnote.c, rtems/src/taskissuspended.c, rtems/src/taskrestart.c, rtems/src/taskresume.c, rtems/src/tasksetnote.c, rtems/src/tasksetpriority.c, rtems/src/taskstart.c, rtems/src/tasksuspend.c, rtems/src/taskvariableadd.c, rtems/src/taskvariabledelete.c, rtems/src/taskvariableget.c, rtems/src/timercancel.c, rtems/src/timerdelete.c, rtems/src/timerfirewhen.c, rtems/src/timergetinfo.c, rtems/src/timerreset.c, rtems/src/timerserverfireafter.c, rtems/src/timerserverfirewhen.c: Restructured all code with the switch (location) pattern so that OBJECTS_LOCAL is first and we can fall into it and the OBJECTS_ERROR case breaks to a return RTEMS_INVALID_ID. This eliminates the return RTEMS_INTERNAL_ERROR at the bottom of each of these files which was unreachable and untestable code. This resulted in a code savings of approximately 20 bytes per file on the SPARC/ERC32.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Rate Monotonic Manager -- Cancel a Period
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/rtems/status.h>
20#include <rtems/rtems/support.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/object.h>
23#include <rtems/rtems/ratemon.h>
24#include <rtems/score/thread.h>
25
26/*PAGE
27 *
28 *  rtems_rate_monotonic_cancel
29 *
30 *  This directive allows a thread to cancel a rate monotonic timer.
31 *
32 *  Input parameters:
33 *    id - rate monotonic id
34 *
35 *  Output parameters:
36 *    RTEMS_SUCCESSFUL - if successful and caller is not the owning thread
37 *    error code       - if unsuccessful
38 */
39
40rtems_status_code rtems_rate_monotonic_cancel(
41  Objects_Id id
42)
43{
44  Rate_monotonic_Control *the_period;
45  Objects_Locations       location;
46
47  the_period = _Rate_monotonic_Get( id, &location );
48  switch ( location ) {
49
50    case OBJECTS_LOCAL:
51      if ( !_Thread_Is_executing( the_period->owner ) ) {
52        _Thread_Enable_dispatch();
53        return RTEMS_NOT_OWNER_OF_RESOURCE;
54      }
55      (void) _Watchdog_Remove( &the_period->Timer );
56      the_period->state = RATE_MONOTONIC_INACTIVE;
57      _Thread_Enable_dispatch();
58      return RTEMS_SUCCESSFUL;
59
60#if defined(RTEMS_MULTIPROCESSING)
61    case OBJECTS_REMOTE:
62#endif
63    case OBJECTS_ERROR:
64      break;
65  }
66
67  return RTEMS_INVALID_ID;
68}
Note: See TracBrowser for help on using the repository browser.