zhengfl
Committed by winlin

fix #511, fix the bug of thread stop invalid.

@@ -100,11 +100,12 @@ namespace internal { @@ -100,11 +100,12 @@ namespace internal {
100 return ret; 100 return ret;
101 } 101 }
102 102
  103 + disposed = false;
103 // we set to loop to true for thread to run. 104 // we set to loop to true for thread to run.
104 loop = true; 105 loop = true;
105 106
106 // wait for cid to ready, for parent thread to get the cid. 107 // wait for cid to ready, for parent thread to get the cid.
107 - while (_cid < 0 && loop) { 108 + while (_cid < 0) {
108 st_usleep(10 * 1000); 109 st_usleep(10 * 1000);
109 } 110 }
110 111
@@ -124,7 +125,9 @@ namespace internal { @@ -124,7 +125,9 @@ namespace internal {
124 125
125 dispose(); 126 dispose();
126 127
127 - tid = NULL; 128 + _cid = -1;
  129 + can_run = false;
  130 + tid = NULL;
128 } 131 }
129 132
130 bool SrsThread::can_loop() 133 bool SrsThread::can_loop()