Modify behavior of modules using shared resources

With this change, modules that use the no argument
form of the usesResource function will not run
at the same time as any other module that has
declared any shared resource or used the no argument
usesResource function.
Optimize registerSharedResource function

Replace a linear search for legacy resources
by a data member that counts them. Also use
the std::make_shared function instead of new.
Merge pull request #1904 from wddgit/sharedResourcesBehavior

Multithreaded framework -- Legacy modules and shared resources