fix thread quit
This commit is contained in:
parent
90f9a1f04d
commit
ad164f576e
2 changed files with 7 additions and 1 deletions
|
|
@ -34,6 +34,8 @@ namespace fc {
|
|||
elog( "Caught unhandled exception" );
|
||||
}
|
||||
slog( "exiting %s", name );
|
||||
delete this->my;
|
||||
slog( "..." );
|
||||
} );
|
||||
p->wait();
|
||||
my->boost_thread = t;
|
||||
|
|
@ -71,9 +73,12 @@ namespace fc {
|
|||
void thread::quit() {
|
||||
if( ¤t() != this ) {
|
||||
wlog( "async quit %s", my->name.c_str() );
|
||||
async( [=](){quit();} ).wait();
|
||||
async( [=](){quit();} );//.wait();
|
||||
if( my->boost_thread ) {
|
||||
auto n = name();
|
||||
slog( "joining... %s", n.c_str() );
|
||||
my->boost_thread->join();
|
||||
slog( "done joining... %s", n.c_str() );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -321,6 +321,7 @@ namespace fc {
|
|||
|
||||
if( done ) return;
|
||||
if( timeout_time == time_point::max() ) {
|
||||
slog("wait");
|
||||
task_ready.wait( lock );
|
||||
} else if( timeout_time != time_point::min() ) {
|
||||
slog("timed wait");
|
||||
|
|
|
|||
Loading…
Reference in a new issue