mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
a15ffb06e6
* half-done support for battles
13 lines
404 B
C++
13 lines
404 B
C++
#pragma once
|
|
#include <boost/thread.hpp>
|
|
template <typename T> struct CondSh
|
|
{
|
|
T data;
|
|
boost::condition_variable cond;
|
|
boost::mutex mx;
|
|
CondSh(){};
|
|
CondSh(T t){data = t;};
|
|
void set(T t){mx.lock();data=t;mx.unlock();}; //set data
|
|
void setn(T t){mx.lock();data=t;mx.unlock();cond.notify_all();}; //set data and notify
|
|
T get(){boost::unique_lock<boost::mutex> lock(mx); return data;};
|
|
}; |