ithewei 6 年之前
父节点
当前提交
92072de801
共有 2 个文件被更改,包括 6 次插入6 次删除
  1. 5 5
      base/hthread.h
  2. 1 1
      utils/iniparser.h

+ 5 - 5
base/hthread.h

@@ -71,10 +71,10 @@ class HThread {
             switchStatus(RUNNING);
             dotask_cnt = 0;
 
-            thread = std::thread([this]{
-                doPrepare();
+            thread = std::thread([this] {
+                if (!doPrepare()) return;
                 run();
-                doFinish();
+                if (!doFinish()) return;
             });
         }
         return 0;
@@ -115,9 +115,9 @@ class HThread {
         }
     }
 
-    virtual void doPrepare() {}
+    virtual bool doPrepare() {return true;}
     virtual void doTask() {}
-    virtual void doFinish() {}
+    virtual bool doFinish() {return true;}
 
     std::thread thread;
     enum Status {

+ 1 - 1
utils/iniparser.h

@@ -110,7 +110,7 @@ class IniParser {
 
     // T = [bool, int, float]
     template<typename T>
-    T Get(const string& key, const string& section = "", const T defvalue = 0);
+    T Get(const string& key, const string& section = "", T defvalue = 0);
 
     // T = [bool, int, float]
     template<typename T>