colobot/src/common/thread/sdl_cond_wrapper.h

32 lines
512 B
C
Raw Normal View History

#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;
};