From 73d74fd020eb11a21fd963e96c4034aadec14979 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 15 Oct 2010 14:47:04 +0300 Subject: something --- core/commonheaders.h | 3 +++ core/core.cbp | 1 + core/main.cpp | 2 ++ core/services.cpp | 5 +++++ 4 files changed, 11 insertions(+) (limited to 'core') 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 #include #include +#include #include +#include + #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 @@ + 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 plugins; +boost::mutex plugin_list_mutex; std::list 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 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::iterator end = services.end(); for(std::list::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::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; } -- cgit v1.2.3