Skip to content

Commit

Permalink
remove ifdefs from BundleRegistry, abide by rule of (0,3,5), and add …
Browse files Browse the repository at this point in the history
…comments
  • Loading branch information
tcormackMW committed May 18, 2023
1 parent f957cd8 commit c602217
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 1 addition & 4 deletions framework/src/bundle/BundleRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,8 @@ namespace cppmicroservices
{
// Wait for the install thread to notify this thread that it is safe
// to install the current bundle
l.UnLock();
#ifdef US_ENABLE_THREADING_SUPPORT
auto& p = initialBundleInstallMap[location];

l.UnLock();
std::unique_lock<std::mutex> lock(*(p.second.m));

// This while loop exists to prevent a known race condition. If the installing thread notifies
Expand All @@ -262,7 +260,6 @@ namespace cppmicroservices
// is reached, wait_for exits and the statement is re-evaluated since it would have returned false.
while (!p.second.cv->wait_for(lock, 0.1ms, [&p] { return !p.second.waitFlag; }))
;
#endif
}

// Re-acquire the range because while this thread was waiting, the installing
Expand Down
5 changes: 4 additions & 1 deletion framework/src/service/ServiceRegistrationCoreInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ namespace cppmicroservices
/**
* \ingroup MicroServices
*/
class ServiceRegistrationCoreInfo : public detail::MultiThreaded<>
class ServiceRegistrationCoreInfo final: public detail::MultiThreaded<>
{

public:
ServiceRegistrationCoreInfo(BundlePrivate* bundle, InterfaceMapConstPtr service, Properties&& props);
~ServiceRegistrationCoreInfo() = default;

ServiceRegistrationCoreInfo(ServiceRegistrationCoreInfo &&) = delete;
ServiceRegistrationCoreInfo& operator=(ServiceRegistrationCoreInfo &&) = delete;

ServiceRegistrationCoreInfo(ServiceRegistrationCoreInfo const&) = delete;
ServiceRegistrationCoreInfo& operator=(ServiceRegistrationCoreInfo const&) = delete;

Expand Down
4 changes: 1 addition & 3 deletions framework/src/util/ServiceRegistrationLocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ namespace cppmicroservices
*
* This is an RAII object, construct it in scope and when it goes out of scope the locks will be released.
*/
class ServiceRegistrationLocks
class ServiceRegistrationLocks final
{
public:
ServiceRegistrationLocks(std::shared_ptr<ServiceRegistrationBasePrivate> reg,
std::shared_ptr<ServiceRegistrationCoreInfo> coreInfo);

~ServiceRegistrationLocks() = default;

private:
cppmicroservices::detail::MutexLockingStrategy<>::UniqueLock coreInfoL;
cppmicroservices::detail::MutexLockingStrategy<>::UniqueLock regL;
Expand Down

0 comments on commit c602217

Please sign in to comment.