Mistake on this page?
Report an issue in GitHub or email us
mutex.h
1 /*
2  * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __OS_WRAPPER_MUTEX_H__
9 #define __OS_WRAPPER_MUTEX_H__
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #include "common.h"
16 
17 /**
18  * \brief Creates a mutex for mutual exclusion of resources
19  *
20  * \return The handle of the created mutex on success or NULL on error
21  */
22 void *os_wrapper_mutex_create(void);
23 
24 /**
25  * \brief Acquires a mutex that is created by \ref os_wrapper_mutex_create()
26  *
27  * \param[in] handle The handle of the mutex to acquire. Should be one of the
28  * handles returned by \ref os_wrapper_mutex_create()
29  * \param[in] timeout The maximum amount of time(in tick periods) for the
30  * thread to wait for the mutex to be available.
31  * If timeout is zero, the function will return immediately.
32  * Setting timeout to \ref OS_WRAPPER_WAIT_FOREVER will
33  * cause the thread to wait indefinitely
34  *
35  * \return \ref OS_WRAPPER_SUCCESS on success or \ref OS_WRAPPER_ERROR on error
36  */
37 uint32_t os_wrapper_mutex_acquire(void *handle, uint32_t timeout);
38 
39 /**
40  * \brief Releases the mutex acquired previously
41  *
42 
43  * \param[in] handle The handle of the mutex that has been acquired
44  *
45  * \return \ref OS_WRAPPER_SUCCESS on success or \ref OS_WRAPPER_ERROR on error
46  */
47 uint32_t os_wrapper_mutex_release(void *handle);
48 
49 /**
50  * \brief Deletes a mutex that is created by \ref os_wrapper_mutex_create()
51  *
52  * \param[in] handle The handle of the mutex to be deleted
53  *
54  * \return \ref OS_WRAPPER_SUCCESS on success or \ref OS_WRAPPER_ERROR on error
55  */
56 uint32_t os_wrapper_mutex_delete(void *handle);
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 
62 #endif /* __OS_WRAPPER_MUTEX_H__ */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.