// -*- c++ -*-

/*
 * Jakelib2 - General purpose C++ library
 * Copyright (C) 2001 Florian Wolff  (florian@donuz.de)
 *
 * 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
 *
 * $Id: Sentry.h,v 1.2 2003/08/29 11:58:55 florian Exp $
 */

#ifdef JAKELIB_THREADS
# ifndef INCLUDE_JAKELIB2_LANG_SENTRY_H
#   define INCLUDE_JAKELIB2_LANG_SENTRY_H
#   include "Mutex.h"

namespace jakelib {
  namespace lang {

    /**
     * @brief A simple wrapper for \c Mutex objects.
     * You should not use this class directly but use the
     * \c JAKELIB_SYNCHRONIZED macro.
     *
     * To achieve a more Java-like behaviour this
     * macro can be used as a substitution for the \c synchronized keyword in java
     * to synchronize a whole block of c++ code on
     * a certain \c Mutex:
     *
     * \code
     * Mutex* mutex = new Mutex();
     *
     * {
     *   Sentry sentry(mutex);
     *   ...
     * }
     * \endcode
     *
     * @deprecated Use \c Synchronizeable instead
     * @class Sentry
     * @version $Id: Sentry.h,v 1.2 2003/08/29 11:58:55 florian Exp $
     * @author Florian 'Overflo' Wolff (florian@donuz.de)
     */
    class Sentry
      {
      private:
        Mutex* mutex;

      public:
	Sentry(Mutex* mutex);

	~Sentry();
      };
  }
}

# endif
#endif

