/*
 *  ZThreads, a platform-independant, multithreading and 
 *  synchroniation library
 *
 *  Copyright (C) 2000-2002, Eric Crahen, See LGPL.TXT for details
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library 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
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 *  SUNY @ Buffalo, hereby disclaims all copyright interest in the
 *  ZThreads library written by Eric Crahen
 */

#ifndef __ZTCANCELABLE_H__
#define __ZTCANCELABLE_H__

#include "zthread/ZThread.h"
#include "zthread/SynchronizationExceptions.h"

namespace ZThread {

/**
 * @class Cancelable
 *
 * @author Eric Crahen <crahen@cse.buffalo.edu>
 * @date <2002-02-24T09:22:45-0500>
 * @version 1.3.0
 *
 * This class defines a 'Cancelable' item. Canceling item indicates that
 * that item should gracefully shutdown and stop at some point soon if
 * not immediately.
 *
 * For instance, canceling a Queue will cause it accept no new items. It
 * can return all items that were added before it was canceled but it 
 * definitely empty at some point. 
 */
class ZTHREAD_API Cancelable {
public:

  /**
   * Destroy this Cancelable object
   */
  virtual ~Cancelable() throw() {}

  /**
   * Indicate that target item should stop accepting new input
   * and shutdown at some point
   */
  virtual void cancel()
    throw(Synchronization_Exception) = 0;

  /**
   * Check the cancelation status of this Queue
   *
   * @return bool - cancelation status
   */
  virtual bool isCanceled()
    throw(Synchronization_Exception) = 0;



};

};

#endif
