source: rtems/cpukit/score/src/corespinlockrelease.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.5 KB
Line 
1/*
2 *  SuperCore Spinlock Handler -- Release a Spinlock
3 *
4 *  COPYRIGHT (c) 1989-2006.
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
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/system.h>
17#include <rtems/score/corespinlock.h>
18#include <rtems/score/states.h>
19#include <rtems/score/thread.h>
20#include <rtems/score/watchdog.h>
21
22/*
23 *  _CORE_spinlock_Release
24 *
25 *  This function releases the spinlock.
26 *
27 *  Input parameters:
28 *    the_spinlock    - the spinlock control block to initialize
29 *
30 *  Output parameters:
31 *    CORE_SPINLOCK_SUCCESSFUL - if successful
32 *    error code               - if unsuccessful
33 *
34 */
35
36CORE_spinlock_Status _CORE_spinlock_Release(
37  CORE_spinlock_Control  *the_spinlock
38)
39{
40  ISR_Level level;
41
42  _ISR_Disable( level );
43
44    /*
45     *  It must locked before it can be unlocked.
46     */
47    if ( the_spinlock->lock == CORE_SPINLOCK_UNLOCKED ) {
48      _ISR_Enable( level );
49      return CORE_SPINLOCK_NOT_LOCKED;
50    }
51
52    /*
53     *  It must locked by the current thread before it can be unlocked.
54     */
55    if ( the_spinlock->holder != _Thread_Executing->Object.id ) {
56      _ISR_Enable( level );
57      return CORE_SPINLOCK_NOT_HOLDER;
58    }
59
60    /*
61     *  Let it be unlocked.
62     */
63    the_spinlock->users -= 1;
64    the_spinlock->lock   = CORE_SPINLOCK_UNLOCKED;
65    the_spinlock->holder = 0;
66
67  _ISR_Enable( level );
68  return CORE_SPINLOCK_SUCCESSFUL;
69}
Note: See TracBrowser for help on using the repository browser.