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/xobject.h>
|
||||
#include <a8/timer_attacher.h>
|
||||
#include <a8/singleton.h>
|
||||
|
||||
#include <a8/strutils.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
|
||||
{
|
||||
|
||||
class PerfMonitor : public a8::Singleton<PerfMonitor>
|
||||
class PerfMonitor
|
||||
{
|
||||
private:
|
||||
PerfMonitor();
|
||||
friend class a8::Singleton<PerfMonitor>;
|
||||
|
||||
A8_DECLARE_SINGLETON(PerfMonitor);
|
||||
public:
|
||||
void Init();
|
||||
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
|
||||
{
|
||||
class BtMgr : public a8::Singleton<BtMgr>
|
||||
class BtMgr
|
||||
{
|
||||
private:
|
||||
BtMgr() {};
|
||||
friend class a8::Singleton<BtMgr>;
|
||||
|
||||
A8_DECLARE_SINGLETON(BtMgr);
|
||||
public:
|
||||
void Init(const std::string& file_path);
|
||||
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<DbExecResult>)> DbExecResultCb;
|
||||
|
||||
class DBPool : public a8::Singleton<DBPool>
|
||||
class DBPool
|
||||
{
|
||||
private:
|
||||
DBPool() {};
|
||||
friend class a8::Singleton<DBPool>;
|
||||
|
||||
A8_DECLARE_SINGLETON(DBPool);
|
||||
public:
|
||||
void Init();
|
||||
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;
|
||||
};
|
||||
|
||||
HttpClientPool::HttpClientPool()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HttpClientPool::Init(int thread_num, int sys_num, int user_num)
|
||||
{
|
||||
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;
|
||||
|
||||
class HttpClientPoolImpl;
|
||||
class HttpClientPool : public a8::Singleton<HttpClientPool>
|
||||
class HttpClientPool
|
||||
{
|
||||
private:
|
||||
HttpClientPool() {};
|
||||
friend class a8::Singleton<HttpClientPool>;
|
||||
|
||||
A8_DECLARE_SINGLETON(HttpClientPool);
|
||||
public:
|
||||
volatile long long max_sys_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
|
||||
{
|
||||
|
||||
class JsonLog : public a8::Singleton<JsonLog>
|
||||
class JsonLog
|
||||
{
|
||||
private:
|
||||
JsonLog();
|
||||
friend class a8::Singleton<JsonLog>;
|
||||
|
||||
A8_DECLARE_SINGLETON(JsonLog);
|
||||
public:
|
||||
~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()
|
||||
{
|
||||
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 list_head* CallBackHandle;
|
||||
|
||||
class MsgQueue : public a8::Singleton<MsgQueue>
|
||||
class MsgQueue
|
||||
{
|
||||
private:
|
||||
MsgQueue() {};
|
||||
friend class a8::Singleton<MsgQueue>;
|
||||
|
||||
A8_DECLARE_SINGLETON(MsgQueue);
|
||||
public:
|
||||
void Init();
|
||||
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
|
||||
{
|
||||
class ScriptEngine : public a8::Singleton<ScriptEngine>
|
||||
{
|
||||
private:
|
||||
ScriptEngine() {};
|
||||
friend class a8::Singleton<ScriptEngine>;
|
||||
|
||||
class ScriptEngine
|
||||
{
|
||||
A8_DECLARE_SINGLETON(ScriptEngine);
|
||||
public:
|
||||
void Init();
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
struct TGLogImpl;
|
||||
class TGLog : public a8::Singleton<TGLog>
|
||||
class TGLog
|
||||
{
|
||||
private:
|
||||
TGLog() {};
|
||||
friend class a8::Singleton<TGLog>;
|
||||
|
||||
A8_DECLARE_SINGLETON(TGLog);
|
||||
public:
|
||||
void Init(const std::string& project_name, bool is_poly_log, int time_zone = 8);
|
||||
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();
|
||||
}
|
||||
|
||||
Timer::Timer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Timer::Init()
|
||||
{
|
||||
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
|
||||
{
|
||||
|
||||
class Timer : public a8::Singleton<Timer>
|
||||
class Timer
|
||||
{
|
||||
|
||||
private:
|
||||
Timer() {};
|
||||
friend class a8::Singleton<Timer>;
|
||||
|
||||
A8_DECLARE_SINGLETON(Timer);
|
||||
public:
|
||||
void Init();
|
||||
void UnInit();
|
||||
|
7
third_party/f8/f8/udplog.h
vendored
7
third_party/f8/f8/udplog.h
vendored
@ -3,12 +3,9 @@
|
||||
namespace f8
|
||||
{
|
||||
|
||||
class UdpLog : public a8::Singleton<UdpLog>
|
||||
class UdpLog
|
||||
{
|
||||
private:
|
||||
UdpLog();
|
||||
friend class a8::Singleton<UdpLog>;
|
||||
|
||||
A8_DECLARE_SINGLETON(UdpLog);
|
||||
public:
|
||||
~UdpLog();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user