1
This commit is contained in:
parent
34f4f1f0cd
commit
1711af9db5
1
third_party/a8/a8/a8.h
vendored
1
third_party/a8/a8/a8.h
vendored
@ -19,7 +19,6 @@
|
|||||||
#include <a8/xvalue.h>
|
#include <a8/xvalue.h>
|
||||||
#include <a8/xobject.h>
|
#include <a8/xobject.h>
|
||||||
#include <a8/timer_attacher.h>
|
#include <a8/timer_attacher.h>
|
||||||
#include <a8/singleton.h>
|
|
||||||
|
|
||||||
#include <a8/strutils.h>
|
#include <a8/strutils.h>
|
||||||
#include <a8/sysutils.h>
|
#include <a8/sysutils.h>
|
||||||
|
7
third_party/a8/a8/perfmonitor.h
vendored
7
third_party/a8/a8/perfmonitor.h
vendored
@ -3,12 +3,9 @@
|
|||||||
namespace a8
|
namespace a8
|
||||||
{
|
{
|
||||||
|
|
||||||
class PerfMonitor : public a8::Singleton<PerfMonitor>
|
class PerfMonitor
|
||||||
{
|
{
|
||||||
private:
|
A8_DECLARE_SINGLETON(PerfMonitor);
|
||||||
PerfMonitor();
|
|
||||||
friend class a8::Singleton<PerfMonitor>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
35
third_party/a8/a8/singleton.h
vendored
35
third_party/a8/a8/singleton.h
vendored
@ -1,35 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace a8
|
|
||||||
{
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
class Singleton
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
static T* Instance()
|
|
||||||
{
|
|
||||||
if (!instance_) {
|
|
||||||
// 二次检查
|
|
||||||
if (!instance_) {
|
|
||||||
instance_ = std::shared_ptr<T> (new T());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance_.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Singleton() {} //防止实例
|
|
||||||
Singleton(const Singleton&) {} //防止拷贝构造一个实例
|
|
||||||
Singleton& operator=(const Singleton&){} //防止赋值出另一个实例
|
|
||||||
~Singleton() {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
static inline std::shared_ptr<T> instance_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
7
third_party/f8/f8/btmgr.h
vendored
7
third_party/f8/f8/btmgr.h
vendored
@ -12,12 +12,9 @@ namespace behaviac
|
|||||||
|
|
||||||
namespace f8
|
namespace f8
|
||||||
{
|
{
|
||||||
class BtMgr : public a8::Singleton<BtMgr>
|
class BtMgr
|
||||||
{
|
{
|
||||||
private:
|
A8_DECLARE_SINGLETON(BtMgr);
|
||||||
BtMgr() {};
|
|
||||||
friend class a8::Singleton<BtMgr>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init(const std::string& file_path);
|
void Init(const std::string& file_path);
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
7
third_party/f8/f8/dbpool.h
vendored
7
third_party/f8/f8/dbpool.h
vendored
@ -28,12 +28,9 @@ namespace f8
|
|||||||
typedef std::function<void(std::shared_ptr<DbQueryResult>)> DbQueryResultCb;
|
typedef std::function<void(std::shared_ptr<DbQueryResult>)> DbQueryResultCb;
|
||||||
typedef std::function<void(std::shared_ptr<DbExecResult>)> DbExecResultCb;
|
typedef std::function<void(std::shared_ptr<DbExecResult>)> DbExecResultCb;
|
||||||
|
|
||||||
class DBPool : public a8::Singleton<DBPool>
|
class DBPool
|
||||||
{
|
{
|
||||||
private:
|
A8_DECLARE_SINGLETON(DBPool);
|
||||||
DBPool() {};
|
|
||||||
friend class a8::Singleton<DBPool>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
5
third_party/f8/f8/httpclientpool.cc
vendored
5
third_party/f8/f8/httpclientpool.cc
vendored
@ -428,6 +428,11 @@ namespace f8
|
|||||||
size_t mutex_buf_size = 0;
|
size_t mutex_buf_size = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HttpClientPool::HttpClientPool()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void HttpClientPool::Init(int thread_num, int sys_num, int user_num)
|
void HttpClientPool::Init(int thread_num, int sys_num, int user_num)
|
||||||
{
|
{
|
||||||
if (thread_num < 0 || sys_num < 0 || user_num < 0) {
|
if (thread_num < 0 || sys_num < 0 || user_num < 0) {
|
||||||
|
7
third_party/f8/f8/httpclientpool.h
vendored
7
third_party/f8/f8/httpclientpool.h
vendored
@ -11,12 +11,9 @@ namespace f8
|
|||||||
typedef std::function<void(bool, a8::XObject*, f8::HttpContext*)> HttpProxyCb;
|
typedef std::function<void(bool, a8::XObject*, f8::HttpContext*)> HttpProxyCb;
|
||||||
|
|
||||||
class HttpClientPoolImpl;
|
class HttpClientPoolImpl;
|
||||||
class HttpClientPool : public a8::Singleton<HttpClientPool>
|
class HttpClientPool
|
||||||
{
|
{
|
||||||
private:
|
A8_DECLARE_SINGLETON(HttpClientPool);
|
||||||
HttpClientPool() {};
|
|
||||||
friend class a8::Singleton<HttpClientPool>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
volatile long long max_sys_request_delay = 0;
|
volatile long long max_sys_request_delay = 0;
|
||||||
volatile long long max_user_request_delay = 0;
|
volatile long long max_user_request_delay = 0;
|
||||||
|
7
third_party/f8/f8/jsonlog.h
vendored
7
third_party/f8/f8/jsonlog.h
vendored
@ -3,12 +3,9 @@
|
|||||||
namespace f8
|
namespace f8
|
||||||
{
|
{
|
||||||
|
|
||||||
class JsonLog : public a8::Singleton<JsonLog>
|
class JsonLog
|
||||||
{
|
{
|
||||||
private:
|
A8_DECLARE_SINGLETON(JsonLog);
|
||||||
JsonLog();
|
|
||||||
friend class a8::Singleton<JsonLog>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~JsonLog();
|
~JsonLog();
|
||||||
|
|
||||||
|
5
third_party/f8/f8/msgqueue.cc
vendored
5
third_party/f8/f8/msgqueue.cc
vendored
@ -146,6 +146,11 @@ namespace f8
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MsgQueue::MsgQueue()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MsgQueue::Init()
|
void MsgQueue::Init()
|
||||||
{
|
{
|
||||||
imp_ = std::make_shared<MsgQueueImp>();
|
imp_ = std::make_shared<MsgQueueImp>();
|
||||||
|
7
third_party/f8/f8/msgqueue.h
vendored
7
third_party/f8/f8/msgqueue.h
vendored
@ -5,12 +5,9 @@ namespace f8
|
|||||||
typedef std::function<void (const a8::Args&)> MsgHandleFunc;
|
typedef std::function<void (const a8::Args&)> MsgHandleFunc;
|
||||||
typedef list_head* CallBackHandle;
|
typedef list_head* CallBackHandle;
|
||||||
|
|
||||||
class MsgQueue : public a8::Singleton<MsgQueue>
|
class MsgQueue
|
||||||
{
|
{
|
||||||
private:
|
A8_DECLARE_SINGLETON(MsgQueue);
|
||||||
MsgQueue() {};
|
|
||||||
friend class a8::Singleton<MsgQueue>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
8
third_party/f8/f8/scriptengine.h
vendored
8
third_party/f8/f8/scriptengine.h
vendored
@ -7,12 +7,10 @@ namespace a8
|
|||||||
|
|
||||||
namespace f8
|
namespace f8
|
||||||
{
|
{
|
||||||
class ScriptEngine : public a8::Singleton<ScriptEngine>
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
ScriptEngine() {};
|
|
||||||
friend class a8::Singleton<ScriptEngine>;
|
|
||||||
|
|
||||||
|
class ScriptEngine
|
||||||
|
{
|
||||||
|
A8_DECLARE_SINGLETON(ScriptEngine);
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
5
third_party/f8/f8/tglog.cc
vendored
5
third_party/f8/f8/tglog.cc
vendored
@ -78,6 +78,11 @@ namespace f8
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TGLog::TGLog()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void TGLog::Init(const std::string& project_name, bool is_poly_log, int time_zone)
|
void TGLog::Init(const std::string& project_name, bool is_poly_log, int time_zone)
|
||||||
{
|
{
|
||||||
time_zone_ = time_zone;
|
time_zone_ = time_zone;
|
||||||
|
7
third_party/f8/f8/tglog.h
vendored
7
third_party/f8/f8/tglog.h
vendored
@ -3,12 +3,9 @@
|
|||||||
namespace f8
|
namespace f8
|
||||||
{
|
{
|
||||||
struct TGLogImpl;
|
struct TGLogImpl;
|
||||||
class TGLog : public a8::Singleton<TGLog>
|
class TGLog
|
||||||
{
|
{
|
||||||
private:
|
A8_DECLARE_SINGLETON(TGLog);
|
||||||
TGLog() {};
|
|
||||||
friend class a8::Singleton<TGLog>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init(const std::string& project_name, bool is_poly_log, int time_zone = 8);
|
void Init(const std::string& project_name, bool is_poly_log, int time_zone = 8);
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
5
third_party/f8/f8/timer.cc
vendored
5
third_party/f8/f8/timer.cc
vendored
@ -25,6 +25,11 @@ namespace f8
|
|||||||
real_obj_.ClearTimerList();
|
real_obj_.ClearTimerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer::Timer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Timer::Init()
|
void Timer::Init()
|
||||||
{
|
{
|
||||||
impl_ = std::make_shared<TimerImpl>();
|
impl_ = std::make_shared<TimerImpl>();
|
||||||
|
8
third_party/f8/f8/timer.h
vendored
8
third_party/f8/f8/timer.h
vendored
@ -3,13 +3,9 @@
|
|||||||
namespace f8
|
namespace f8
|
||||||
{
|
{
|
||||||
|
|
||||||
class Timer : public a8::Singleton<Timer>
|
class Timer
|
||||||
{
|
{
|
||||||
|
A8_DECLARE_SINGLETON(Timer);
|
||||||
private:
|
|
||||||
Timer() {};
|
|
||||||
friend class a8::Singleton<Timer>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
7
third_party/f8/f8/udplog.h
vendored
7
third_party/f8/f8/udplog.h
vendored
@ -3,12 +3,9 @@
|
|||||||
namespace f8
|
namespace f8
|
||||||
{
|
{
|
||||||
|
|
||||||
class UdpLog : public a8::Singleton<UdpLog>
|
class UdpLog
|
||||||
{
|
{
|
||||||
private:
|
A8_DECLARE_SINGLETON(UdpLog);
|
||||||
UdpLog();
|
|
||||||
friend class a8::Singleton<UdpLog>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~UdpLog();
|
~UdpLog();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user