1
This commit is contained in:
parent
685a81bc54
commit
1b43f53bb2
28
server/robotserver/coroutine.cc
Normal file
28
server/robotserver/coroutine.cc
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include "coroutine.h"
|
||||||
|
|
||||||
|
Coroutine::Coroutine(std::function<void(Coroutine* co)> cb)
|
||||||
|
{
|
||||||
|
cb_ = cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Coroutine::CoSuspend()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Coroutine::CoResume()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Coroutine::CoAwait(Awaiter& awaiter)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Coroutine::CoAwait(Awaiter* awaiter)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
29
server/robotserver/coroutine.h
Normal file
29
server/robotserver/coroutine.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <boost/coroutine2/all.hpp>
|
||||||
|
|
||||||
|
class Awaiter
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class Promise : public Awaiter
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class Coroutine : public Awaiter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
Coroutine(std::function<void(Coroutine* co)> cb);
|
||||||
|
|
||||||
|
void CoSuspend();
|
||||||
|
void CoResume();
|
||||||
|
void CoAwait(Awaiter& awaiter);
|
||||||
|
void CoAwait(Awaiter* awaiter);
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::coroutines2::coroutine<void> coro_;
|
||||||
|
std::function<void(Coroutine* co)> cb_;
|
||||||
|
};
|
@ -2,5 +2,8 @@
|
|||||||
|
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
std::string account_id;
|
||||||
|
std::string session_id;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include <boost/coroutine2/all.hpp>
|
||||||
|
|
||||||
#include <f8/udplog.h>
|
#include <f8/udplog.h>
|
||||||
|
|
||||||
#include "playermgr.h"
|
#include "playermgr.h"
|
||||||
@ -10,6 +12,9 @@
|
|||||||
|
|
||||||
void PlayerMgr::Init()
|
void PlayerMgr::Init()
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMgr::UnInit()
|
void PlayerMgr::UnInit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user