diff options
author | Alex Grubb <agrubb@cmu.edu> | 2013-12-12 02:36:48 +0400 |
---|---|---|
committer | Alex Grubb <agrubb@cmu.edu> | 2013-12-12 02:36:48 +0400 |
commit | ad0e361334df83ba1d0c633aaad79616356ecf05 (patch) | |
tree | 3a189726b0e93c79e2cddeae4a8a5b502842b568 /vowpalwabbit/learner.cc | |
parent | d57e63fd98fb7317f72e35deccbc1838e075c1b5 (diff) |
fix bug with pthread deadlock in when early termination is used
Diffstat (limited to 'vowpalwabbit/learner.cc')
-rw-r--r-- | vowpalwabbit/learner.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vowpalwabbit/learner.cc b/vowpalwabbit/learner.cc index f11bdcc0..36ac3e12 100644 --- a/vowpalwabbit/learner.cc +++ b/vowpalwabbit/learner.cc @@ -13,12 +13,7 @@ namespace LEARNER all->l->init_driver(); while ( true ) { - if(all->early_terminate) - { - all->p->done = true; - return; - } - else if ((ec = VW::get_example(all->p)) != NULL)//semiblocking operation. + if ((ec = VW::get_example(all->p)) != NULL)//semiblocking operation. { if (ec->indices.size() > 1) // one nonconstant feature. { @@ -47,7 +42,17 @@ namespace LEARNER else { all->l->learn(ec); - all->l->finish_example(*all, ec); + + if(all->early_terminate) + { + all->p->done = true; + all->l->finish_example(*all, ec); + return; + } + else + { + all->l->finish_example(*all, ec); + } } } else if (parser_done(all->p)) |