2012-12-11 55 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