source: rtems/cpukit/posix/src/pspindestroy.c @ a0e6c73

4.115
Last change on this file since a0e6c73 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 *  POSIX Spinlock Manager -- Destroy a Spinlock
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
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <pthread.h>
17#include <errno.h>
18
19#include <rtems/system.h>
20#include <rtems/posix/spinlock.h>
21
22/*
23 *  pthread_spin_destroy
24 *
25 *  This directive allows a thread to delete a spinlock specified by
26 *  the spinlock id.  The spinlock is freed back to the inactive
27 *  spinlock chain.
28 *
29 *  Input parameters:
30 *    spinlock - spinlock id
31 *
32 *  Output parameters:
33 *    0           - if successful
34 *    error code  - if unsuccessful
35 */
36
37int pthread_spin_destroy(
38  pthread_spinlock_t *spinlock
39)
40{
41  POSIX_Spinlock_Control *the_spinlock = NULL;
42  Objects_Locations      location;
43
44  if ( !spinlock )
45    return EINVAL;
46
47  the_spinlock = _POSIX_Spinlock_Get( spinlock, &location );
48  switch ( location ) {
49
50    case OBJECTS_LOCAL:
51      if ( _CORE_spinlock_Is_busy( &the_spinlock->Spinlock ) ) {
52        _Thread_Enable_dispatch();
53        return EBUSY;
54      }
55
56      _Objects_Close( &_POSIX_Spinlock_Information, &the_spinlock->Object );
57
58      _POSIX_Spinlock_Free( the_spinlock );
59
60      _Thread_Enable_dispatch();
61      return 0;
62
63#if defined(RTEMS_MULTIPROCESSING)
64    case OBJECTS_REMOTE:
65#endif
66    case OBJECTS_ERROR:
67      break;
68  }
69
70  return EINVAL;
71}
Note: See TracBrowser for help on using the repository browser.