/builddir/build/BUILD/raul-0.4.0/raul/Command.hpp

00001 /* This file is part of Raul.
00002  * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
00003  * 
00004  * Raul is free software; you can redistribute it and/or modify it under the
00005  * terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  * 
00009  * Raul is distributed in the hope that it will be useful, but WITHOUT ANY
00010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for details.
00012  * 
00013  * You should have received a copy of the GNU General Public License along
00014  * with this program; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00016  */
00017 
00018 #ifndef RAUL_COMMAND_HPP
00019 #define RAUL_COMMAND_HPP
00020 
00021 #include <raul/Semaphore.hpp>
00022 #include <boost/utility.hpp>
00023 
00024 namespace Raul {
00025 
00026 
00037 class Command : boost::noncopyable {
00038 public:
00039     inline Command() : _sem(0) {}
00040 
00042     inline void operator()() { _sem.wait(); }
00043 
00045     inline bool pending() { return _sem.has_waiter(); }
00046     inline void finish()  { _sem.post(); }
00047 
00048 private:
00049     Semaphore _sem;
00050 };
00051 
00052 
00053 } // namespace Raul
00054 
00055 #endif // RAUL_COMMAND_HPP

Generated on Wed Apr 9 08:14:41 2008 for RAUL by  doxygen 1.5.1