mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
util: Add extern "C" guard in simple_mtx.h
This is a header that can be accessed both in C/C++, And when remove the usage of _MTX_INITIALIZER_NP in latter commits, it's need implement simple_mtx_init in .c file, so for ABI consistence Add the extern "C" for cpp files Also add comment for #endif guard for code readability Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17122>
This commit is contained in:
parent
67cd0c44d2
commit
064ec944c1
1 changed files with 14 additions and 2 deletions
|
|
@ -40,6 +40,14 @@
|
|||
# define HG(x)
|
||||
#endif
|
||||
|
||||
#endif /* UTIL_FUTEX_SUPPORTED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if UTIL_FUTEX_SUPPORTED
|
||||
|
||||
/* mtx_t - Fast, simple mutex
|
||||
*
|
||||
* While modern pthread mutexes are very fast (implemented using futex), they
|
||||
|
|
@ -135,7 +143,7 @@ simple_mtx_assert_locked(simple_mtx_t *mtx)
|
|||
assert(mtx->val);
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* !UTIL_FUTEX_SUPPORTED */
|
||||
|
||||
typedef mtx_t simple_mtx_t;
|
||||
|
||||
|
|
@ -181,6 +189,10 @@ simple_mtx_assert_locked(simple_mtx_t *mtx)
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif /* UTIL_FUTEX_SUPPORTED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* _SIMPLE_MTX_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue