/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2013 University of California, Los Angeles
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
 *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
 */

#ifndef EXECUTOR_H
#define EXECUTOR_H

#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/thread.hpp>
#include <deque>

#include "logging.h"

/* A very simple executor to execute submitted tasks immediately or
 * in the future (depending on whether there is idle thread)
 * A fixed number of threads are created for executing tasks;
 * The policy is FIFO
 * No cancellation of submitted tasks
 */

class Executor
{
public:
  typedef boost::function<void ()> Job;

  Executor(int poolSize);
  ~Executor();

  // execute the job immediately or sometime in the future
  void
  execute(const Job &job);

  int
  poolSize();

// only for test
  int
  jobQueueSize();

  void
  start ();

  void
  shutdown ();

private:
  void
  run();

  Job
  waitForJob();

private:
  typedef std::deque<Job> JobQueue;
  typedef boost::mutex Mutex;
  typedef boost::unique_lock<Mutex> Lock;
  typedef boost::condition_variable Cond;
  typedef boost::thread Thread;
  typedef boost::thread_group ThreadGroup;
  JobQueue m_queue;
  Mutex m_mutex;
  Cond m_cond;
  ThreadGroup m_group;

  volatile bool m_needStop;
  int m_poolSize;

  MEMBER_LOGGER
};

typedef boost::shared_ptr<Executor> ExecutorPtr;
#endif // EXECUTOR_H
