okay maybe not
This commit is contained in:
@@ -44,6 +44,7 @@ set(OLIVE_SOURCES
|
||||
common/ratiodialog.cpp
|
||||
common/rational.h
|
||||
common/rational.cpp
|
||||
common/threadsafemap.h
|
||||
common/threadedobject.h
|
||||
common/threadedobject.cpp
|
||||
common/timecodefunctions.h
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef THREADSAFEMAP_H
|
||||
#define THREADSAFEMAP_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QMutex>
|
||||
|
||||
template <typename K, typename V>
|
||||
class ThreadSafeMap
|
||||
{
|
||||
public:
|
||||
ThreadSafeMap() = default;
|
||||
|
||||
void insert(K key, V value)
|
||||
{
|
||||
mutex_.lock();
|
||||
map_.insert(key, value);
|
||||
mutex_.unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
QMutex mutex_;
|
||||
|
||||
QMap<K, V> map_;
|
||||
|
||||
};
|
||||
|
||||
#endif // THREADSAFEMAP_H
|
||||
Reference in New Issue
Block a user