colobot/src/common/thread/sdl_cond_wrapper.h

51 lines
1.3 KiB
C
Raw Normal View History

2015-08-19 18:27:29 +00:00
/*
* This file is part of the Colobot: Gold Edition source code
2016-02-13 13:11:30 +00:00
* Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
2015-08-22 14:40:02 +00:00
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
2015-08-19 18:27:29 +00:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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, see http://gnu.org/licenses
*/
#pragma once
#include <SDL_thread.h>
2015-08-04 18:57:53 +00:00
/**
* \class CSDLCondWrapper
* \brief Wrapper for safe creation/deletion of SDL_cond
*/
class CSDLCondWrapper
{
public:
2015-08-04 18:57:53 +00:00
CSDLCondWrapper()
: m_cond(SDL_CreateCond())
{}
2015-08-04 18:57:53 +00:00
~CSDLCondWrapper()
{
SDL_DestroyCond(m_cond);
}
2015-08-04 18:57:53 +00:00
CSDLCondWrapper(const CSDLCondWrapper&) = delete;
CSDLCondWrapper& operator=(const CSDLCondWrapper&) = delete;
SDL_cond* operator*()
{
return m_cond;
}
private:
SDL_cond* m_cond;
};