我编写了一个简单的NDK程序,它有一个在另一个线程中运行的记录器。
我的程序运行成功,但之后程序退出,有时它在运行我的c ++代码并且正常工作后不会退出。 任何人都知道为什么我的程序在运行代码后退出。
当我使用strace调试我的程序时,它告诉我+++被SIGSEGV +++杀死
semget(0x1c, 0xbe9222e8, 0x10, 0xffffffff) = -1 EINTR (Interrupted system call)
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
msgget(0x1, 0xbe922430, 0x418fce8c, 0xa8121b40) = 0
semget(0x1c, 0xbe9222e8, 0x10, 0xffffffff) = -1 EINTR (Interrupted system call)
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
--- SIGSTOP (Stopped (signal)) @ 0 (0) ---
msgget(0x1, 0xbe922430, 0x418fce8c, 0xa8121b40) = 0
semget(0x1c, 0xbe9222e8, 0x10, 0xffffffff <unfinished ...>
+++ killed by SIGSEGV +++
如果我禁用该线程一切正常可能使用logcat登录另一个线程是不安全的
答案 0 :(得分:0)
@waxspin 在我的记录器线程被破坏之前,你的程序退出了。