Mercurial > hg > svcore
diff system/System.cpp @ 1178:bf05d9259dbc pluginscan
First cut running (but not yet using output of, or recovering from errors in) the plugin checker at startup
author | Chris Cannam |
---|---|
date | Thu, 14 Apr 2016 12:12:04 +0100 |
parents | afed8be79032 |
children | 6b1af0f05f06 |
line wrap: on
line diff
--- a/system/System.cpp Fri Mar 18 14:25:05 2016 +0000 +++ b/system/System.cpp Thu Apr 14 12:12:04 2016 +0100 @@ -335,6 +335,11 @@ { //!!! This is POSIX only, no equivalent on Windows, where we'll //!!! have to do something completely different + + //!!! update -- this is a bad idea on POSIX systems as well, I + //!!! fear, because fork() generally doesn't mix with + //!!! multithreaded processes (it forks only one thread but any + //!!! locked mutexes from the other threads remain locked). pid_t pid = fork(); @@ -344,6 +349,8 @@ if (pid == 0) { // the child process + cerr << "isPluginLibraryLoadable: About to try library \"" << soname << "\"" << endl; + void *handle = DLOPEN(soname, RTLD_NOW | RTLD_LOCAL); if (!handle) { cerr << "isPluginLibraryLoadable: Failed to open plugin library \"" @@ -358,7 +365,7 @@ exit(2); } -// cerr << "isPluginLibraryLoadable: Successfully loaded library \"" << soname << "\" and retrieved descriptor function" << endl; + cerr << "isPluginLibraryLoadable: Successfully loaded library \"" << soname << "\" and retrieved descriptor function" << endl; exit(0); @@ -367,9 +374,13 @@ int status = 0; do { + cerr << "waiting for subprocess with pid " << pid << "..." << endl; waitpid(pid, &status, 0); + cerr << "waited" << endl; } while (WIFSTOPPED(status)); + cerr << "and finished" << endl; + if (WIFEXITED(status)) { switch (WEXITSTATUS(status)) { case 0: return PluginLoadOK; // success