#include <vector>
#include <map>
+class Guard
+{
+public:
+ explicit Guard(sw::BackoffLock* in) : mMutex(in)
+ {
+ mMutex->lock();
+ }
+
+ ~Guard()
+ {
+ mMutex->unlock();
+ }
+protected:
+ sw::BackoffLock* mMutex;
+};
+
namespace egl
{
EGLSyncKHR Display::createSync(Context *context)
{
FenceSync *fenceSync = new egl::FenceSync(context);
-
+ Guard lk(&mSyncSetMutex);
mSyncSet.insert(fenceSync);
-
return fenceSync;
}
void Display::destroySync(FenceSync *sync)
{
- mSyncSet.erase(sync);
-
+ {
+ Guard lk(&mSyncSetMutex);
+ mSyncSet.erase(sync);
+ }
delete sync;
}
bool Display::isValidSync(FenceSync *sync)
{
+ Guard lk(&mSyncSetMutex);
return mSyncSet.find(sync) != mSyncSet.end();
}
#define INCLUDE_DISPLAY_H_
#include "Config.h"
+#include "Common/MutexLock.hpp"
#include "Sync.hpp"
#include "common/NameSpace.hpp"
ContextSet mContextSet;
typedef std::set<FenceSync*> SyncSet;
+ sw::BackoffLock mSyncSetMutex;
SyncSet mSyncSet;
gl::NameSpace<Image> mSharedImageNameSpace;