mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-07 11:50:13 +00:00
Remove suicidalThread hack from Thread.
This commit is contained in:
parent
9df88a3933
commit
2ba97fb46b
@ -47,7 +47,6 @@ static void *__m_thread_main(void *ptr)
|
|||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
Thread::Thread() :
|
Thread::Thread() :
|
||||||
suicidalThread(false),
|
|
||||||
_impl(malloc(sizeof(pthread_t))),
|
_impl(malloc(sizeof(pthread_t))),
|
||||||
_running()
|
_running()
|
||||||
{
|
{
|
||||||
@ -84,10 +83,6 @@ void Thread::__intl_run()
|
|||||||
for(;;) {
|
for(;;) {
|
||||||
_notInit = false;
|
_notInit = false;
|
||||||
this->main();
|
this->main();
|
||||||
if (suicidalThread) {
|
|
||||||
delete this;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_notInit) // UGLY ASS HACK: see main()
|
if (_notInit) // UGLY ASS HACK: see main()
|
||||||
usleep(50);
|
usleep(50);
|
||||||
else break;
|
else break;
|
||||||
@ -127,7 +122,6 @@ struct __m_thread_info
|
|||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
Thread::Thread() :
|
Thread::Thread() :
|
||||||
suicidalThread(false),
|
|
||||||
_impl(malloc(sizeof(__m_thread_info))),
|
_impl(malloc(sizeof(__m_thread_info))),
|
||||||
_running()
|
_running()
|
||||||
{
|
{
|
||||||
@ -162,10 +156,6 @@ void Thread::__intl_run()
|
|||||||
for(;;) {
|
for(;;) {
|
||||||
_notInit = false;
|
_notInit = false;
|
||||||
this->main();
|
this->main();
|
||||||
if (suicidalThread) {
|
|
||||||
delete this;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_notInit)
|
if (_notInit)
|
||||||
Thread::sleep(50);
|
Thread::sleep(50);
|
||||||
else break;
|
else break;
|
||||||
|
@ -78,11 +78,6 @@ protected:
|
|||||||
virtual void main()
|
virtual void main()
|
||||||
throw();
|
throw();
|
||||||
|
|
||||||
/**
|
|
||||||
* Subclasses can set to true to cause Thread to delete itself on exit
|
|
||||||
*/
|
|
||||||
volatile bool suicidalThread;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void *_impl;
|
void *_impl;
|
||||||
AtomicCounter _running;
|
AtomicCounter _running;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user