Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 c++ boost 停止(中断)光纤?
例如
fiber.stop()
如何使用 c+ boost 执行光纤连接(时间)(默认 api 不接受最大等待时间)?例如:
fiber.join(1000);
是否可以暂停光纤,在磁盘上对其进行序列化,然后将其重新加载到系统中?
boost.fiber 以 std::threads 的 API 为模型 - 没有中断功能,也没有定时连接。
您不能序列化纤程,因为这意味着序列化纤程的堆栈是不可能的……至少在没有编译器支持的情况下是不可能的。
不建议使用堆栈序列化,因为编译器必须注意指向堆栈上分配的对象的指针,例如必须在相同地址重新分配对象,或者必须在反序列化纤程(重新加载)后重新写入指针。
RAII 违规很容易发生等......