RTEMS
pspinunlock.c
Go to the documentation of this file.
1 
9 /*
10  * POSIX Spinlock Manager -- Wait at a Spinlock
11  *
12  * COPYRIGHT (c) 1989-2007.
13  * On-Line Applications Research Corporation (OAR).
14  *
15  * Copyright (c) 2016 embedded brains GmbH
16  *
17  * The license and distribution terms for this file may be
18  * found in the file LICENSE in this distribution or at
19  * http://www.rtems.org/license/LICENSE.
20  */
21 
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25 
27 
28 int pthread_spin_unlock( pthread_spinlock_t *lock )
29 {
30  POSIX_Spinlock_Control *the_spinlock;
31  ISR_Level level;
32 #if defined(RTEMS_SMP) && defined(RTEMS_PROFILING)
33  SMP_lock_Stats unused_stats;
34  SMP_lock_Stats_context unused_context;
35 #endif
36 
37  the_spinlock = _POSIX_Spinlock_Get( lock );
38  level = the_spinlock->interrupt_state;
39 #if defined(RTEMS_SMP)
40 #if defined(RTEMS_PROFILING)
41  /* This is a hack to get around the lock profiling statistics */
42  unused_stats.total_section_time = 0;
43  unused_stats.max_section_time = 0;
44  unused_context.stats = &unused_stats;
45  unused_context.acquire_instant = 0;
46 #endif
48  &the_spinlock->Lock,
49  &unused_context
50  );
51 #endif
52  _ISR_Local_enable( level );
53  return 0;
54 }
Inlined Routines from the POSIX Spinlock Manager.
#define _SMP_ticket_lock_Release(lock, stats_context)
Releases an SMP ticket lock.
uint32_t ISR_Level
Definition: isrlevel.h:41
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
Definition: isrlevel.h:74