我編譯的例子parallel.cpp
與boost::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;
}
Boost版本? –
你調試過嗎? – Synxis