gpt4 book ai didi

c++ - 在抛出 '__gnu_cxx::recursive_init' 实例后调用终止

转载 作者:行者123 更新时间:2023-11-28 03:58:25 25 4
gpt4 key购买 nike

我用谷歌搜索了上面的错误;没用。

此错误来自以下代码行:

void Thread::join(void** status) {
pthread_join(thread, status);
}

有人知道这是什么意思吗?

(谷歌提出其他人提示错误,但没有解释)。

最佳答案

引用 http://www.opensource.apple.com/source/libstdcxx/libstdcxx-5.1/libstdcxx/libstdc++-v3/libsupc++/guard.cc :

namespace __gnu_cxx
{
// 6.7[stmt.dcl]/4: If control re-enters the declaration (recursively)
// while the object is being initialized, the behavior is undefined.

// Since we already have a library function to handle locking, we might
// as well check for this situation and throw an exception.
// We use the second byte of the guard variable to remember that we're
// in the middle of an initialization.
class recursive_init: public std::exception

....

static int
acquire_1 (__guard *g)
{
if (_GLIBCXX_GUARD_TEST (g))
return 0;

if (recursion_push (g))
{
#ifdef __EXCEPTIONS
throw __gnu_cxx::recursive_init();
...

请检查是否有一些静态变量需要自己先初始化。

关于c++ - 在抛出 '__gnu_cxx::recursive_init' 实例后调用终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2278710/

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