Tests: Add tests for fibers and refactor/fix Fiber class
This commit is contained in:
parent
bc266a9d98
commit
8d0e3c5422
4 changed files with 247 additions and 19 deletions
|
@ -10,6 +10,12 @@
|
|||
#include "common/common_types.h"
|
||||
#include "common/spin_lock.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
namespace boost::context::detail {
|
||||
struct transfer_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace Common {
|
||||
|
||||
class Fiber {
|
||||
|
@ -31,9 +37,6 @@ public:
|
|||
/// Only call from main thread's fiber
|
||||
void Exit();
|
||||
|
||||
/// Used internally but required to be public, Shall not be used
|
||||
void _start(void* parameter);
|
||||
|
||||
/// Changes the start parameter of the fiber. Has no effect if the fiber already started
|
||||
void SetStartParameter(void* new_parameter) {
|
||||
start_parameter = new_parameter;
|
||||
|
@ -42,6 +45,16 @@ public:
|
|||
private:
|
||||
Fiber();
|
||||
|
||||
#ifdef _MSC_VER
|
||||
void start();
|
||||
static void FiberStartFunc(void* fiber_parameter);
|
||||
#else
|
||||
void start(boost::context::detail::transfer_t& transfer);
|
||||
static void FiberStartFunc(boost::context::detail::transfer_t transfer);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
struct FiberImpl;
|
||||
|
||||
SpinLock guard;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue