diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-03 13:22:34 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-03 13:22:34 +0300 |
commit | 9a44caeb992e365d747fa9f6900310f72785836a (patch) | |
tree | 60fbf9aaa3cf18e033906880cbb6d2493a1939e9 /core | |
parent | 6f01f33a040b6a4f078332dc9056e7efea29a5ee (diff) |
starting plugins in threads
Diffstat (limited to 'core')
-rw-r--r-- | core/main.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/core/main.cpp b/core/main.cpp index ae1dbf0..aa6a7fc 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -16,6 +16,7 @@ list<service*> services; int LoadModules(); INT_PTR CallService(const char *name, WPARAM w, LPARAM l); HANDLE CreateServiceFunction(const char *name, SERVICE pService); +DWORD WINAPI OnModulesLoadedThread( LPVOID lpParam ); int ServiceExists(const char *name); SERVICE GetPluginInfoList(WPARAM, LPARAM); SERVICE Test(WPARAM, LPARAM); @@ -35,7 +36,10 @@ int main(int argc, char *argv[]) for(list<plugin*>::iterator p = plugins.begin(); p != plugins.end(); p++) { if((*p)->getFuncs().loaded) - (*p)->getFuncs().loaded(); + { + CreateThread(NULL, 0, OnModulesLoadedThread, (LPVOID)(*p)->getFuncs().loaded, 0, 0); +// (*p)->getFuncs().loaded(); + } } CallService("GetPluginInfoList", 0, 0); for(;;) @@ -146,7 +150,8 @@ INT_PTR CallService(const char *name, WPARAM w, LPARAM l) } HANDLE CreateServiceFunction(const char *name, SERVICE pService) { - services.push_back(new service(name, pService)); + if(!ServiceExists(name)) + services.push_back(new service(name, pService)); } int ServiceExists(const char *name) { @@ -168,3 +173,11 @@ SERVICE Test(WPARAM, LPARAM) MessageBoxA(0, "Test service working", "INFO", MB_OK); return 0; } + +DWORD WINAPI OnModulesLoadedThread( LPVOID lpParam ) +{ + OnModulesLoaded &l = (OnModulesLoaded&)lpParam; + l(); + return 0; +} + |