22 #include <SDL_mutex.h>
23 #include <SDL_thread.h>
24 #include <SDL_version.h>
26 #define ERR_G LOG_STREAM(err, lg::general())
38 op->notify_finished();
45 std::vector<SDL_Thread*> detached_threads;
54 SDL_WaitThread(*
i,
nullptr);
59 : thread_(SDL_CreateThread(
f,
"", data))
71 SDL_WaitThread(
thread_,
nullptr);
78 detached_threads.push_back(
thread_);
105 SDL_DestroyCond(
cond_);
110 return SDL_CondWait(
cond_,m.
m_) == 0;
115 const int res = SDL_CondWaitTimeout(
cond_,m.
m_,timeout);
120 ERR_G <<
"SDL_CondWaitTimeout: " << SDL_GetError() << std::endl;
127 if(SDL_CondSignal(
cond_) < 0) {
128 ERR_G <<
"SDL_CondSignal: " << SDL_GetError() << std::endl;
137 if(SDL_CondBroadcast(
cond_) < 0) {
138 ERR_G <<
"SDL_CondBroadcast: " << SDL_GetError() << std::endl;
165 bool completed =
false;
thread(int(*f)(void *), void *data=nullptr)
boost::scoped_ptr< thread > thread_
RESULT execute(async_operation_ptr this_ptr, waiter &wait)
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
WAIT_TIMEOUT_RESULT wait_timeout(const mutex &m, unsigned int timeout)
static active_operation_list active_
virtual ACTION process()=0
static int run_async_operation(void *data)
GLbitfield GLuint64 timeout
boost::uint32_t get_current_thread_id()
Standard logging facilities (interface).
std::list< async_operation_ptr > active_operation_list
bool wait(const mutex &m)