Skip to content

Commit

Permalink
fix back thread bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nickyang4github committed Mar 9, 2018
1 parent 101e79c commit 65ed0f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Frame/Examples/Tutorial1/HelloWorld1.cpp
Expand Up @@ -43,9 +43,9 @@ bool HelloWorld1::AfterInit()
{
std::cout << "Hello, world1, AfterInit" << std::endl;

// test timer
time_id_1 = t->repeat(1000, 10, [](timerid_t id) { std::cout << "T1 ID = " << id << ", interval=1000ms print timer update" << std::endl; });
time_id_2 = t2->repeat(1500, 10, [](timerid_t id) { std::cout << "T2 ID = " << id << ", interval=1500ms print timer update" << std::endl; });
//// test timer
//time_id_1 = t->repeat(1000, 10, [](timerid_t id) { std::cout << "T1 ID = " << id << ", interval=1000ms print timer update" << std::endl; });
//time_id_2 = t2->repeat(1500, 10, [](timerid_t id) { std::cout << "T2 ID = " << id << ", interval=1500ms print timer update" << std::endl; });

//////////////////////////////////////////////////////////////////////////
//test memory alloc
Expand All @@ -69,8 +69,8 @@ bool HelloWorld1::AfterInit()

void HelloWorld1::Update()
{
t->update();
t2->update();
//t->update();
//t2->update();
}

bool HelloWorld1::BeforeShut()
Expand Down
5 changes: 3 additions & 2 deletions Frame/SDK/PluginLoader/AFPluginLoader.cpp
Expand Up @@ -103,7 +103,6 @@ void CreateBackThread()
{
gThread = std::thread(std::bind(&ThreadFunc));
std::cout << "CreateBackThread, thread ID = " << gThread.get_id() << std::endl;
gThread.join();
}

void InitDaemon()
Expand Down Expand Up @@ -186,7 +185,7 @@ int main(int argc, char* argv[])
AFCPluginManager::GetInstancePtr()->CheckConfig();

//back thread, for some cmd
//CreateBackThread();
CreateBackThread();

while(!bExitApp) //DEBUG版本崩溃,RELEASE不崩
{
Expand Down Expand Up @@ -218,6 +217,8 @@ int main(int argc, char* argv[])

AFCPluginManager::GetInstancePtr()->ReleaseInstance();

gThread.join();

return 0;
}

0 comments on commit 65ed0f5

Please sign in to comment.