抛出'__gnu_cxx :: recursive init'实例后调用终止

时间:2010-02-17 06:22:00

标签: c++ pthreads

我已经搜索了上述错误;没用。

此错误来自以下代码行:

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

任何人都知道这意味着什么?

(谷歌提出了其他人对这个错误的抱怨,但没有解释它。)

1 个答案:

答案 0 :(得分:2)

参考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();
  ...

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