2012-12-11 20 views
0

我编译的例子parallel.cppboost::coroutines::coroutine一起发货都是32位和64位程序。升级协程不能在Windows x86_64上运行?

它们都编译和链接没有错误。 32位程序运行并按预期运行,但64位应用程序在启动时崩溃。

在Windows 7 64位上使用Visual Studio 2012 Express。

编辑:协同程序已被接受为提振,但尚未发布作为升压发行版的一部分。我使用了作者'最终'版本中的例子。

编辑:这是代码升压干线

#include <boost/bind.hpp> 
#include <boost/coroutine/all.hpp> 

typedef boost::coroutines::coroutine< void() > coroutine_t; 

void first(coroutine_t::caller_type & self) 
{ 
    std::cout << "started first! "; 
    for (int i = 0; i < 10; ++i) 
    { 
     self(); 
     std::cout << "a" << i; 
    } 
} 

void second(coroutine_t::caller_type & self) 
{ 
    std::cout << "started second! "; 
    for (int i = 0; i < 10; ++i) 
    { 
     self(); 
     std::cout << "b" << i; 
    } 
} 

int main(int argc, char * argv[]) 
{ 
    { 
     coroutine_t c1(boost::bind(first, _1)); 
     coroutine_t c2(boost::bind(second, _1)); 
     while (c1 && c2) { 
      c1(); 
      std::cout << " "; 
      c2(); 
      std::cout << " "; 
     } 
    } 

    std::cout << "\nDone" << std::endl; 

    return EXIT_SUCCESS; 
} 
+0

Boost版本? –

+0

你调试过吗? – Synxis

回答

2

使用最新版本 - 包含boost.coroutine + boost.context的最新版本(使用boost.coroutine上下文交换) 尝试先建立单元测试(/ libs/coroutine/test)

+0

中继版本正常工作。谢谢 – user841550