gpt4 book ai didi

c++ - 不确定性 std::system_error: what(): 不允许操作

转载 作者:行者123 更新时间:2023-11-30 02:16:56 27 4
gpt4 key购买 nike

我正在尝试运行我的程序,但在几次运行中我遇到了一个错误:

terminate called after throwing an instance of 'std::system_error'
what(): Operation not permitted

我的代码在这里可用:https://github.com/Qabrt/turnstiles

gdb 输出:

Thread 31 "trivial_test" received signal SIGABRT, Aborted.
[Switching to thread 31 (Thread 0x7fff8a7fc700 (LWP 8716))]
#0 0x00007ffff6e7f83b in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff6e7f83b in raise () from /lib64/libc.so.6
#1 0x00007ffff6e81081 in abort () from /lib64/libc.so.6
#2 0x00007ffff78670e5 in __gnu_cxx::__verbose_terminate_handler ()
at /var/tmp/portage/sys-devel/gcc-7.3.0-r3/work/gcc-7.3.0/libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x00007ffff7864cb6 in __cxxabiv1::__terminate (handler=<optimized out>)
at /var/tmp/portage/sys-devel/gcc-7.3.0-r3/work/gcc-7.3.0/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4 0x00007ffff7864d01 in std::terminate ()
at /var/tmp/portage/sys-devel/gcc-7.3.0-r3/work/gcc-7.3.0/libstdc++-v3/libsupc++/eh_terminate.cc:57
#5 0x00007ffff789243f in std::execute_native_thread_routine (__p=0x555555790f80)
at /var/tmp/portage/sys-devel/gcc-7.3.0-r3/work/gcc-7.3.0/libstdc++-v3/src/c++11/thread.cc:91
#6 0x00007ffff7bbd96a in start_thread () from /lib64/libpthread.so.0
#7 0x00007ffff6f4d11f in clone () from /lib64/libc.so.6

g++ --版本

g++ (Gentoo 7.3.0-r3 p1.4) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

我正在使用 -lpthread 标志进行编译:

/usr/bin/c++    -Wall -Wunused-function -Wwrite-strings -Wformat -Wformat-security -Wparentheses -Wsequence-point -Wno-system-headers -Werror -Winit-self  -g -O0 -fstack-protector-all -D_GLIBXX_DEBUG -D_GLIBXX_DEBUG_PEDANTIC  -rdynamic CMakeFiles/trivial_test.dir/trivial_test.cpp.o  -o trivial_test ../libturnstile_lib.a -lpthread

如何获得有关该问题的更多信息?

最佳答案

将函数设置为 noexcept 后,我​​能够找到堆栈跟踪,显示我正在对不存在的互斥体上的 unique_lock 调用 condition_variable::wait()。只是我在其上调用 wait() 的信号量对象为空。因此 system_error 由 unique_lock 抛出,如 https://en.cppreference.com/w/cpp/thread/unique_lock/lock

关于c++ - 不确定性 std::system_error: what(): 不允许操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54199561/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com