RetroArch
lock.h
Go to the documentation of this file.
1 /*
2  lock.h
3 
4  Copyright (c) 2008 Sven Peter <[email protected]>
5 
6  Redistribution and use in source and binary forms, with or without modification,
7  are permitted provided that the following conditions are met:
8 
9  1. Redistributions of source code must retain the above copyright notice,
10  this list of conditions and the following disclaimer.
11  2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation and/or
13  other materials provided with the distribution.
14  3. The name of the author may not be used to endorse or promote products derived
15  from this software without specific prior written permission.
16 
17  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
18  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
20  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 */
28 
29 #ifndef _LOCK_H
30 #define _LOCK_H
31 
32 #include "common.h"
33 
34 #ifdef USE_LWP_LOCK
35 
36 static inline void _FAT_lock_init(mutex_t *mutex)
37 {
38  LWP_MutexInit(mutex, false);
39 }
40 
41 static inline void _FAT_lock_deinit(mutex_t *mutex)
42 {
44 }
45 
46 static inline void _FAT_lock(mutex_t *mutex)
47 {
49 }
50 
51 static inline void _FAT_unlock(mutex_t *mutex)
52 {
54 }
55 
56 #else
57 
58 // We still need a blank lock type
59 #ifndef mutex_t
60 typedef int mutex_t;
61 #endif
62 
65 void _FAT_lock(mutex_t *mutex);
67 
68 #endif // USE_LWP_LOCK
69 
70 
71 #endif // _LOCK_H
72 
void _FAT_lock_init(mutex_t *mutex)
int mutex_t
typedef for the mutex handle
Definition: lock.c:6
void _FAT_unlock(mutex_t *mutex)
s32 LWP_MutexDestroy(mutex_t mutex)
Close mutex lock, release all threads and handles locked on this mutex.
Definition: mutex.c:122
s32 LWP_MutexLock(mutex_t mutex)
Enter the mutex lock.
Definition: mutex.c:138
void _FAT_lock(mutex_t *mutex)
s32 LWP_MutexUnlock(mutex_t mutex)
Release the mutex lock and let other threads process further on this mutex.
Definition: mutex.c:148
static sys_sem mutex
Definition: memp.c:120
void _FAT_lock_deinit(mutex_t *mutex)
s32 LWP_MutexInit(mutex_t *mutex, bool use_recursive)
Initializes a mutex lock.
Definition: mutex.c:101
int mutex_t
Definition: lock.h:60