summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-10-15 14:47:04 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-10-15 14:47:04 +0300
commit73d74fd020eb11a21fd963e96c4034aadec14979 (patch)
tree92c7c67183f90c98378a1a3eea32f2cb3e90a7a1
parent7890dccf61ba5e92d76e79c121b926ac515d6747 (diff)
something
-rw-r--r--core/commonheaders.h3
-rw-r--r--core/core.cbp1
-rw-r--r--core/main.cpp2
-rw-r--r--core/services.cpp5
-rw-r--r--plugins/example/example.cbp6
5 files changed, 17 insertions, 0 deletions
diff --git a/core/commonheaders.h b/core/commonheaders.h
index 23a419f..6cb468d 100644
--- a/core/commonheaders.h
+++ b/core/commonheaders.h
@@ -17,8 +17,11 @@
#include <wx/dir.h>
#include <wx/log.h>
#include <wx/stdpaths.h>
+#include <wx/thread.h>
#include <list>
+#include <boost/thread/mutex.hpp>
+
#include "../api/pluginapi.h"
#include "services.h"
#include "modules.h"
diff --git a/core/core.cbp b/core/core.cbp
index 674714a..47f94f0 100644
--- a/core/core.cbp
+++ b/core/core.cbp
@@ -44,6 +44,7 @@
<Unit filename="main.cpp" />
<Unit filename="modules.cpp" />
<Unit filename="modules.h" />
+ <Unit filename="services.cpp" />
<Unit filename="services.h" />
<Extensions>
<envvars />
diff --git a/core/main.cpp b/core/main.cpp
index 716b7b0..dc145a5 100644
--- a/core/main.cpp
+++ b/core/main.cpp
@@ -2,7 +2,9 @@
#include "commonheaders.h"
std::list<plugin*> plugins;
+boost::mutex plugin_list_mutex;
std::list<service*> services;
+boost::mutex service_list_mutex;
void CreateServiceFunction(const char* name, SERVICE svc);
void* CallService(const char *,void*);
int ServiceExists(const char *);
diff --git a/core/services.cpp b/core/services.cpp
index 56ee05e..836b4c6 100644
--- a/core/services.cpp
+++ b/core/services.cpp
@@ -1,6 +1,7 @@
#include "commonheaders.h"
extern std::list<service*> services;
+extern boost::mutex service_list_mutex;
int ServiceExists(const char *name);
void CreateServiceFunction(const char* name, SERVICE svc)
@@ -13,17 +14,20 @@ void* CallService(const char *name,void* data)
{
if(!services.empty())
{
+ service_list_mutex.lock();
std::list<service*>::iterator end = services.end();
for(std::list<service*>::iterator i = services.begin(); i != end; ++i)
{
if(!strcmp((*i)->getName(), name))
return (*i)->getService()(data);
}
+ service_list_mutex.unlock();
}
return 0;
}
int ServiceExists(const char *name)
{
+ service_list_mutex.lock();
if(!services.empty())
{
std::list<service*>::iterator end = services.end();
@@ -31,6 +35,7 @@ int ServiceExists(const char *name)
if(!strcmp((*i)->getName(), name))
return 1;
}
+ service_list_mutex.unlock();
return 0;
}
diff --git a/plugins/example/example.cbp b/plugins/example/example.cbp
index 64c5694..c36a3bf 100644
--- a/plugins/example/example.cbp
+++ b/plugins/example/example.cbp
@@ -13,7 +13,12 @@
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
+ <Add option="-fPIC `wx-config --unicode=yes --cflags`" />
+ <Add directory="../../api" />
</Compiler>
+ <Linker>
+ <Add option="-shared `wx-config --unicode=yes --libs`" />
+ </Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/example" prefix_auto="1" extension_auto="1" />
@@ -31,6 +36,7 @@
<Compiler>
<Add option="-Wall" />
</Compiler>
+ <Unit filename="main.cpp" />
<Extensions>
<envvars />
<code_completion />