message: Replace lock guard with an atomic variable
diff: @@ -40,7 +40,7 @@ struct sync_params
  std::atomic<long> tile_fin_counter;
  std::atomic<long> tile_num;
  - bool start_threads;
  + std::atomic<bool> start_threads;
  std::atomic<bool> render_loop_exit;
  };
  @@ -158,11 +158,7 @@ void tiled_sched<R>::impl::destroy_threads()
  }
  sync_params.render_loop_exit = true;
  -
  - {
  - std::lock_guard<std::mutex> lock(sync_params.mutex);
  sync_params.start_threads = true;
  - }
  sync_params.threads_start.notify_all();
  for (unsigned i = 0; i < num_threads; ++i)
  @@ -191,7 +187,15 @@ void tiled_sched<R>::impl::render_loop()
  {
  {
  std::unique_lock<std::mutex> l( sync_params.mutex );
  - sync_params.threads_start.wait(l, [this](){ return sync_params.start_threads; });
  + auto const& start_threads = sync_params.start_threads;
  + sync_params.threads_start.wait(
  + l,
  + [&start_threads]()
  + -> std::atomic<bool> const&
  + {
  + return start_threads;
  + }
  + );
  }
  // case event.exit:
  @@ -319,10 +323,7 @@ void tiled_sched<R>::frame(K kernel, SP sched_params, unsigned frame_num)
  sparams.tile_num = numtilesx * numtilesy;
  // render frame
  - {
  - std::lock_guard<std::mutex> lock(sparams.mutex);
  sparams.start_threads = true;
  - }
  sparams.threads_start.notify_all();
  sparams.threads_ready.wait();
  