在崩溃的日志输出中,回溯输出有一个错误:
#00 pc 00038cf0 /apex/com.android.runtime/lib/bionic/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+100)
我去搜索这个文件,可以在下面的链接中找到: https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/private/bionic_futex.h
在此文件中有函数 **__futex_wait_ex ** 的声明:
static inline int __futex_wait_ex(volatile void* ftx, bool shared, int value) {
return __futex(ftx, (shared ? FUTEX_WAIT_BITSET : FUTEX_WAIT_BITSET_PRIVATE), value, nullptr,
FUTEX_BITSET_MATCH_ANY);
}
__LIBC_HIDDEN__ int __futex_wait_ex(volatile void* ftx, bool shared, int value,
bool use_realtime_clock, const timespec* abs_timeout);
LIBC_HIDDEN有什么作用?
我在互联网上搜索了一些解释,但找不到直接答案。 我希望这是我的地方使用的模式,这样很容易找到。
这是一个在 https://android.googlesource.com/platform/bionic/+/a818445/libc/include/sys/cdefs.h
中定义的宏如
/* Used to tag non-static symbols that are private and never exposed by the shared library. */
#define __LIBC_HIDDEN__ __attribute__((visibility("hidden")))
基本上,这意味着您不能在实现它们的共享库之外使用标记为 LIBC_HIDDEN 的函数。