我编译的例子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