Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
arch
ia64
include
asm
mutex.h
Go to the documentation of this file.
1
/*
2
* ia64 implementation of the mutex fastpath.
3
*
4
* Copyright (C) 2006 Ken Chen <
[email protected]
>
5
*
6
*/
7
8
#ifndef _ASM_MUTEX_H
9
#define _ASM_MUTEX_H
10
21
static
inline
void
22
__mutex_fastpath_lock
(
atomic_t
*
count
,
void
(*fail_fn)(
atomic_t
*))
23
{
24
if
(
unlikely
(
ia64_fetchadd4_acq
(count, -1) != 1))
25
fail_fn(count);
26
}
27
38
static
inline
int
39
__mutex_fastpath_lock_retval
(
atomic_t
*count,
int
(*fail_fn)(
atomic_t
*))
40
{
41
if
(
unlikely
(
ia64_fetchadd4_acq
(count, -1) != 1))
42
return
fail_fn(count);
43
return
0;
44
}
45
59
static
inline
void
60
__mutex_fastpath_unlock
(
atomic_t
*count,
void
(*fail_fn)(
atomic_t
*))
61
{
62
int
ret
=
ia64_fetchadd4_rel
(count, 1);
63
if
(
unlikely
(ret < 0))
64
fail_fn(count);
65
}
66
67
#define __mutex_slowpath_needs_to_unlock() 1
68
84
static
inline
int
85
__mutex_fastpath_trylock
(
atomic_t
*count,
int
(*fail_fn)(
atomic_t
*))
86
{
87
if
(
cmpxchg_acq
(count, 1, 0) == 1)
88
return
1;
89
return
0;
90
}
91
92
#endif
Generated on Thu Jan 10 2013 12:50:01 for Linux Kernel by
1.8.2