~vadim-tk/sysbench/sysbench-pareto-merge

« back to all changes in this revision

Viewing changes to sysbench/sysbench.c

  • Committer: Alexey Kopytov
  • Date: 2012-03-21 08:20:02 UTC
  • Revision ID: akopytov@gmail.com-20120321082002-6yc23odnl51arur8
Fixed a crash at the end of the test when tx-rate is not used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
719
719
  pthread_t    report_thread;
720
720
  pthread_t    checkpoints_thread;
721
721
  pthread_t    eventgen_thread;
722
 
  int          report_thread_created = 0;
 
722
  int          report_thread_created      = 0;
723
723
  int          checkpoints_thread_created = 0;
 
724
  int          eventgen_thread_created    = 0;
724
725
 
725
726
  /* initialize test */
726
727
  if (test->ops.init != NULL && test->ops.init() != 0)
792
793
      log_errno(LOG_FATAL, "pthread_create() for the reporting thread failed.");
793
794
      return 1;
794
795
    }
 
796
    eventgen_thread_created = 1;
795
797
  }
796
798
 
797
799
  if (sb_globals.n_checkpoints > 0)
877
879
      log_errno(LOG_FATAL, "Terminating the reporting thread failed.");
878
880
  }
879
881
 
880
 
  if (pthread_cancel(eventgen_thread) || pthread_join(eventgen_thread, NULL))
881
 
    log_text(LOG_FATAL, "Terminating the event generator thread failed.");
 
882
  if (eventgen_thread_created)
 
883
  {
 
884
    if (pthread_cancel(eventgen_thread) || pthread_join(eventgen_thread, NULL))
 
885
      log_text(LOG_FATAL, "Terminating the event generator thread failed.");
 
886
  }
882
887
 
883
888
  if (checkpoints_thread_created)
884
889
  {