Lunchbox  1.6.0
timedLock.h
00001 
00002 /* Copyright (c) 2005-2012, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef LUNCHBOX_TIMEDLOCK_H
00019 #define LUNCHBOX_TIMEDLOCK_H
00020 
00021 #include <lunchbox/api.h>
00022 #include <lunchbox/nonCopyable.h> // base class
00023 #include <lunchbox/types.h>
00024 
00025 namespace lunchbox
00026 {
00027 namespace detail { class TimedLock; }
00028 
00030     class TimedLock : public NonCopyable
00031     {
00032     public:
00034         LUNCHBOX_API TimedLock();
00035 
00037         LUNCHBOX_API ~TimedLock();
00038 
00047         LUNCHBOX_API bool set( const uint32_t timeout = LB_TIMEOUT_INDEFINITE );
00048 
00050         LUNCHBOX_API void unset();
00051 
00058         LUNCHBOX_API bool trySet();
00059 
00066         LUNCHBOX_API bool isSet();
00067 
00068     private:
00069         detail::TimedLock* const _impl;
00070     };
00071 }
00072 #endif //LUNCHBOX_TIMEDLOCK_H