網狐框架分析四 服務裝載器 150617

2021-07-03 08:33:06 字數 3534 閱讀 2283

##1 服務裝載器 serviceloader 流程

---#2 流程分析

#cserviceloaderdlg::onbnclickedstart()//啟動

=> //載入一些初始化資料

=>m_gameservice->startservice()//核心元件啟動服務

=>cgameservice::startservice()//

==>m_tcpsocketcorrespond->settcpsocketevent()//

===>m_queueserviceevent.setqueueservicesink()//

====>m_piqueueservice.startservice()//

====>cqueueservice::startservice()//開始服務,建立完成埠,建立執行緒

*****>m_queueservicethread.startthread()//

*****>cservicethread::startthread()//_beginthreadex

*****=>cservicethread::threadfunction()//

*****=>pservicethread->oneventthreadrun()//while迴圈呼叫函式

------>cqueueservicethread::oneventthreadrun()//等待完成埠

------>getqueuedcompletionstatus()//接收postqueuedcompletionstatus傳送的訊息

------->pqueueservice->onqueueservicethread()//處理訊息

------->m_piqueueservicesink->onqueueservicesink()//

=>m_tcpnetworkengine->settcpnetworkengineevent()//核心元件啟動服務

==>m_queueserviceevent.setqueueservicesink()//繫結網路引擎和觸發伺服器

===>m_piqueueservice.startservice()//

===>cqueueservice::startservice()//建立完成埠,建立執行緒

====>m_queueservicethread.startthread()//_beginthreadex

*****>cservicethread::threadfunction()//執行緒

*****=>pservicethread->oneventthreadrun()//while迴圈呼叫函式

------>cqueueservicethread::oneventthreadrun()//等待完成埠

------>getqueuedcompletionstatus()//

------->pqueueservice->onqueueservicethread()//

------->m_piqueueservicesink->onqueueservicesink()//

---==>m_timerengine->startservice()     //時間引擎

===>m_timerthread.startthread() //啟動服務

===>cservicethread::startthread()//進入函式,開啟監聽執行緒_beginthreadex

====> cservicethread::threadfunction()//執行緒函式

*****>pservicethread->oneventthreadrun()//while迴圈中的函式

==>m_tcpsocketcorrespond->startservice()//網路引擎

===>cqueueservice::startservice()//

====>createiocompletionport //建立完成埠

====> cservicethread::startthread()//啟動監聽執行緒_beginthreadex

*****>pservicethread->oneventthreadrun()//乙個while迴圈監聽函式

==>m_attemperengine->startservice()//排程引擎

===>m_queueservice.startservice()//啟動佇列

===>cqueueservice::startservice()//建立完成埠,啟動執行緒

====>m_queueservicethread.startthread()//

====>cservicethread::startthread()//_beginthreadex

*****>cservicethread::threadfunction()//

*****=>pservicethread->oneventthreadrun()//while迴圈呼叫函式

==>m_databaseengine->startservice()//資料引擎

===>cdatabaseengine::startservice()//啟動服務

====>m_queueserviceevent.setqueueservicesink()//設定佇列

*****>cqueueservice::startservice()//建立完成埠,起執行緒

*****=>m_queueservicethread.startthread()//

*****=> cservicethread::startthread()//_beginthreadex

*****==>pservicethread->oneventthreadrun()//while迴圈呼叫函式

====>m_pidatabaseenginesink->ondatabaseenginestart()//啟動外掛程式

*****>cdatabasesink::ondatabaseenginestart()//模組啟動

*****>m_accountsdbmodule->setconnectioninfo()//連資料庫

*****=>cdatabase::setconnectioninfo()//設定構造連線字串

*****>m_accountsdbmodule->openconnection()//發起連線

*****=>cdatabase::openconnection()//發起連線

*****==>m_dbconnection->open()//_connectionptr m_dbconnection;//資料庫物件

==>m_tcpnetworkengine->startservice()//網路引擎

===>ctcpnetworkengine::startservice()//

//1.獲取cpu執行緒數

//2.建立完成埠(啟動監聽執行緒while迴圈呼叫函式)

//3.建立監聽socket

//4.啟動傳送佇列 m_sendqueueservice.startservice();

//5.建立讀寫執行緒,建立應答執行緒,執行讀寫執行緒,網路檢測線程,執行應答執行緒

網狐框架分析四 服務裝載器

1 服務裝載器 serviceloader 流程 2 流程分析 cserviceloaderdlg onbnclickedstart 啟動 載入一些初始化資料 m gameservice startservice 核心元件啟動服務 cgameservice startservice m tcpsoc...

網狐框架分析二 登入伺服器

1 登入伺服器 logonserver啟動流程 flow st start start io inputoutput verification op operation your operation cond condition yes or no?e end st io op cond cond ...

網狐框架分析二 登入伺服器 150617

1 登入伺服器 logonserver啟動流程 flow st start start io inputoutput verification op operation your operation cond condition yes or no?e end st io op cond cond ...