From e94aaf93237b23346fdb872e6d4d2b21f67d379c Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Sun, 17 May 2026 17:26:21 -0400 Subject: [PATCH] Update include paths and namespacing --- include/spinscale/component.h | 2 +- include/spinscale/componentThread.h | 12 +++++----- include/spinscale/cps/asynchronousBridge.h | 4 ++-- .../spinscale/cps/asynchronousContinuation.h | 14 ++++++------ .../cps/asynchronousContinuationChainLink.h | 8 +++---- include/spinscale/cps/callableTracer.h | 14 ++++++------ include/spinscale/cps/callback.h | 4 ++-- include/spinscale/cps/dependencyGraph.h | 4 ++-- include/spinscale/cps/lockSet.h | 8 +++---- include/spinscale/cps/lockerAndInvokerBase.h | 4 ++-- include/spinscale/cps/qutex.h | 8 +++---- .../cps/qutexAcquisitionHistoryTracker.h | 8 +++---- .../cps/serializedAsynchronousContinuation.h | 22 +++++++++---------- include/spinscale/puppetApplication.h | 12 +++++----- src/callableTracer.cpp | 6 ++--- src/componentThread.cpp | 22 +++++++++---------- src/lockerAndInvokerBase.cpp | 6 ++--- src/puppetApplication.cpp | 20 ++++++++--------- src/qutex.cpp | 8 +++---- src/qutexAcquisitionHistoryTracker.cpp | 12 +++++----- 20 files changed, 99 insertions(+), 99 deletions(-) diff --git a/include/spinscale/component.h b/include/spinscale/component.h index 9546117..1896f34 100644 --- a/include/spinscale/component.h +++ b/include/spinscale/component.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include namespace sscl { diff --git a/include/spinscale/componentThread.h b/include/spinscale/componentThread.h index da45d71..902f0d9 100644 --- a/include/spinscale/componentThread.h +++ b/include/spinscale/componentThread.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -162,10 +162,10 @@ public: // Thread management methods typedef std::function threadLifetimeMgmtOpCbFn; - void startThreadReq(Callback callback); - void exitThreadReq(Callback callback); - void pauseThreadReq(Callback callback); - void resumeThreadReq(Callback callback); + void startThreadReq(cps::Callback callback); + void exitThreadReq(cps::Callback callback); + void pauseThreadReq(cps::Callback callback); + void resumeThreadReq(cps::Callback callback); /** * JOLTs this thread to begin processing after global initialization. @@ -180,7 +180,7 @@ public: */ void joltThreadReq( const std::shared_ptr& selfPtr, - Callback callback); + cps::Callback callback); // CPU management methods void pinToCpu(int cpuId); diff --git a/include/spinscale/cps/asynchronousBridge.h b/include/spinscale/cps/asynchronousBridge.h index fe77394..febb2c3 100644 --- a/include/spinscale/cps/asynchronousBridge.h +++ b/include/spinscale/cps/asynchronousBridge.h @@ -5,7 +5,7 @@ #include #include -namespace sscl { +namespace sscl::cps { class AsynchronousBridge { @@ -53,6 +53,6 @@ private: boost::asio::io_service &io_service; }; -} // namespace sscl +} // namespace sscl::cps #endif // ASYNCHRONOUS_BRIDGE_H diff --git a/include/spinscale/cps/asynchronousContinuation.h b/include/spinscale/cps/asynchronousContinuation.h index cb7fcee..c21f8fb 100644 --- a/include/spinscale/cps/asynchronousContinuation.h +++ b/include/spinscale/cps/asynchronousContinuation.h @@ -5,12 +5,12 @@ #include #include #include -#include -#include -#include +#include +#include +#include -namespace sscl { +namespace sscl::cps { /** * AsynchronousContinuation - Template base class for async sequence management @@ -129,7 +129,7 @@ class PostedAsynchronousContinuation { public: PostedAsynchronousContinuation( - const std::shared_ptr &caller, + const std::shared_ptr &caller, Callback originalCbFn) : AsynchronousContinuation(originalCbFn), caller(caller) @@ -150,9 +150,9 @@ public: } public: - std::shared_ptr caller; + std::shared_ptr caller; }; -} // namespace sscl +} // namespace sscl::cps #endif // ASYNCHRONOUS_CONTINUATION_H diff --git a/include/spinscale/cps/asynchronousContinuationChainLink.h b/include/spinscale/cps/asynchronousContinuationChainLink.h index 79ffd08..b3e06cb 100644 --- a/include/spinscale/cps/asynchronousContinuationChainLink.h +++ b/include/spinscale/cps/asynchronousContinuationChainLink.h @@ -4,10 +4,10 @@ #include #include #include -#include -#include -namespace sscl { +namespace sscl::cps { + +class LockSet; /** * @brief Base class for all asynchronous continuation chain links @@ -38,6 +38,6 @@ public: { return std::nullopt; } }; -} // namespace sscl +} // namespace sscl::cps #endif // ASYNCHRONOUS_CONTINUATION_CHAIN_LINK_H diff --git a/include/spinscale/cps/callableTracer.h b/include/spinscale/cps/callableTracer.h index 6569b61..efd8b4c 100644 --- a/include/spinscale/cps/callableTracer.h +++ b/include/spinscale/cps/callableTracer.h @@ -8,7 +8,7 @@ #include #include -namespace sscl { +namespace sscl::cps { /** * @brief CallableTracer - Wraps callables with metadata for debugging @@ -49,8 +49,8 @@ public: if (optTraceCallables) { std::cout << "" << __func__ << ": On thread " - << (ComponentThread::tlsInitialized() - ? ComponentThread::getSelf()->name : "") + << (sscl::ComponentThread::tlsInitialized() + ? sscl::ComponentThread::getSelf()->name : "") << ": Calling callable posted by:\n" << "\t" << callerFuncName << "\n\tat line " << (int)callerLine << " return addr 0: " << returnAddr0 @@ -79,7 +79,7 @@ private: std::function callable; }; -} // namespace sscl +} // namespace sscl::cps /** * @brief STC - SMO Traceable Callable macro @@ -109,7 +109,7 @@ private: // e.g., "void smo::SomeClass::method(int, int)" // __builtin_return_address(0) = direct caller // __builtin_return_address(1) = caller before that - #define STC(arg) sscl::CallableTracer( \ + #define STC(arg) sscl::cps::CallableTracer( \ __PRETTY_FUNCTION__, \ __LINE__, \ __builtin_return_address(0), \ @@ -120,7 +120,7 @@ private: // e.g., "void __cdecl smo::SomeClass::method(int, int)" // _ReturnAddress() = direct caller (only one level available) #include - #define STC(arg) sscl::CallableTracer( \ + #define STC(arg) sscl::cps::CallableTracer( \ __FUNCSIG__, \ __LINE__, \ _ReturnAddress(), \ @@ -129,7 +129,7 @@ private: #else // Fallback to standard __func__ (unqualified name only) // No return address support - #define STC(arg) sscl::CallableTracer( \ + #define STC(arg) sscl::cps::CallableTracer( \ __func__, \ __LINE__, \ nullptr, \ diff --git a/include/spinscale/cps/callback.h b/include/spinscale/cps/callback.h index 1dfeb50..e3415e1 100644 --- a/include/spinscale/cps/callback.h +++ b/include/spinscale/cps/callback.h @@ -3,7 +3,7 @@ #include -namespace sscl { +namespace sscl::cps { // Forward declaration class AsynchronousContinuationChainLink; @@ -26,6 +26,6 @@ public: CbFnT callbackFn; }; -} // namespace sscl +} // namespace sscl::cps #endif // SPINSCALE_CALLBACK_H diff --git a/include/spinscale/cps/dependencyGraph.h b/include/spinscale/cps/dependencyGraph.h index 2cefe45..c55edf1 100644 --- a/include/spinscale/cps/dependencyGraph.h +++ b/include/spinscale/cps/dependencyGraph.h @@ -6,7 +6,7 @@ #include #include -namespace sscl { +namespace sscl::cps { // Forward declarations class AsynchronousContinuationChainLink; @@ -80,6 +80,6 @@ private: AdjacencyList adjacencyList; }; -} // namespace sscl +} // namespace sscl::cps #endif // DEPENDENCY_GRAPH_H diff --git a/include/spinscale/cps/lockSet.h b/include/spinscale/cps/lockSet.h index 78edeba..89d2368 100644 --- a/include/spinscale/cps/lockSet.h +++ b/include/spinscale/cps/lockSet.h @@ -6,10 +6,10 @@ #include #include #include -#include -#include +#include +#include -namespace sscl { +namespace sscl::cps { class Qutex; @@ -280,6 +280,6 @@ private: bool allLocksAcquired, registeredInQutexQueues; }; -} // namespace sscl +} // namespace sscl::cps #endif // LOCK_SET_H diff --git a/include/spinscale/cps/lockerAndInvokerBase.h b/include/spinscale/cps/lockerAndInvokerBase.h index 528ebef..466f4ef 100644 --- a/include/spinscale/cps/lockerAndInvokerBase.h +++ b/include/spinscale/cps/lockerAndInvokerBase.h @@ -4,7 +4,7 @@ #include #include -namespace sscl { +namespace sscl::cps { // Forward declaration class Qutex; @@ -82,6 +82,6 @@ protected: const void* serializedContinuationVaddr; }; -} // namespace sscl +} // namespace sscl::cps #endif // LOCKER_AND_INVOKER_BASE_H diff --git a/include/spinscale/cps/qutex.h b/include/spinscale/cps/qutex.h index dfa06f8..56646cf 100644 --- a/include/spinscale/cps/qutex.h +++ b/include/spinscale/cps/qutex.h @@ -6,9 +6,9 @@ #include #include #include -#include +#include -namespace sscl { +namespace sscl::cps { /** * @brief Qutex - Queue-based mutex for asynchronous lock management @@ -97,11 +97,11 @@ public: std::string name; std::shared_ptr currOwner; #endif - SpinLock lock; + sscl::SpinLock lock; LockerAndInvokerBase::List queue; bool isOwned; }; -} // namespace sscl +} // namespace sscl::cps #endif // QUTEX_H diff --git a/include/spinscale/cps/qutexAcquisitionHistoryTracker.h b/include/spinscale/cps/qutexAcquisitionHistoryTracker.h index 73a6aa7..2d67128 100644 --- a/include/spinscale/cps/qutexAcquisitionHistoryTracker.h +++ b/include/spinscale/cps/qutexAcquisitionHistoryTracker.h @@ -5,10 +5,10 @@ #include #include #include -#include "spinLock.h" +#include -namespace sscl { +namespace sscl::cps { // Forward declarations class Qutex; @@ -155,10 +155,10 @@ private: * Therefore, it's best to use a SpinLock on the history class to avoid * these coupling issues. */ - SpinLock acquisitionHistoryLock; + sscl::SpinLock acquisitionHistoryLock; AcquisitionHistoryMap acquisitionHistory; }; -} // namespace sscl +} // namespace sscl::cps #endif // QUTEX_ACQUISITION_HISTORY_TRACKER_H diff --git a/include/spinscale/cps/serializedAsynchronousContinuation.h b/include/spinscale/cps/serializedAsynchronousContinuation.h index 58c6db0..3c0f783 100644 --- a/include/spinscale/cps/serializedAsynchronousContinuation.h +++ b/include/spinscale/cps/serializedAsynchronousContinuation.h @@ -8,13 +8,13 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -namespace sscl { +namespace sscl::cps { template class SerializedAsynchronousContinuation @@ -22,7 +22,7 @@ class SerializedAsynchronousContinuation { public: SerializedAsynchronousContinuation( - const std::shared_ptr &caller, + const std::shared_ptr &caller, Callback originalCbFn, std::vector> requiredLocks) : PostedAsynchronousContinuation(caller, originalCbFn), @@ -83,7 +83,7 @@ public: LockerAndInvoker( SerializedAsynchronousContinuation &serializedContinuation, - const std::shared_ptr& target, + const std::shared_ptr& target, InvocationTargetT invocationTarget) : LockerAndInvokerBase(&serializedContinuation), #ifdef CONFIG_ENABLE_DEBUG_LOCKS @@ -266,7 +266,7 @@ public: #endif SerializedAsynchronousContinuation &serializedContinuation; - std::shared_ptr target; + std::shared_ptr target; InvocationTargetT invocationTarget; }; }; @@ -470,7 +470,7 @@ template void SerializedAsynchronousContinuation ::LockerAndInvoker::operator()() { - if (ComponentThread::getSelf() != target) + if (sscl::ComponentThread::getSelf() != target) { throw std::runtime_error( "LockerAndInvoker::operator(): Thread safety violation - " @@ -588,6 +588,6 @@ void SerializedAsynchronousContinuation invocationTarget(); } -} // namespace sscl +} // namespace sscl::cps #endif // SERIALIZED_ASYNCHRONOUS_CONTINUATION_H diff --git a/include/spinscale/puppetApplication.h b/include/spinscale/puppetApplication.h index 24b5e06..f7bf2d9 100644 --- a/include/spinscale/puppetApplication.h +++ b/include/spinscale/puppetApplication.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include namespace sscl { @@ -21,15 +21,15 @@ public: // Thread management methods typedef std::function puppetThreadLifetimeMgmtOpCbFn; void joltAllPuppetThreadsReq( - Callback callback); + cps::Callback callback); void startAllPuppetThreadsReq( - Callback callback); + cps::Callback callback); void pauseAllPuppetThreadsReq( - Callback callback); + cps::Callback callback); void resumeAllPuppetThreadsReq( - Callback callback); + cps::Callback callback); void exitAllPuppetThreadsReq( - Callback callback); + cps::Callback callback); // CPU distribution method void distributeAndPinThreadsAcrossCpus(); diff --git a/src/callableTracer.cpp b/src/callableTracer.cpp index 47ae82d..7953dd6 100644 --- a/src/callableTracer.cpp +++ b/src/callableTracer.cpp @@ -1,7 +1,7 @@ -#include +#include -namespace sscl { +namespace sscl::cps { bool CallableTracer::optTraceCallables = false; -} // namespace sscl +} // namespace sscl::cps diff --git a/src/componentThread.cpp b/src/componentThread.cpp index d45986d..cd897bc 100644 --- a/src/componentThread.cpp +++ b/src/componentThread.cpp @@ -5,9 +5,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -79,14 +79,14 @@ const std::shared_ptr ComponentThread::getSelf(void) } class PuppetThread::ThreadLifetimeMgmtOp -: public PostedAsynchronousContinuation +: public cps::PostedAsynchronousContinuation { public: ThreadLifetimeMgmtOp( const std::shared_ptr &caller, const std::shared_ptr &target, - Callback callback) - : PostedAsynchronousContinuation( + cps::Callback callback) + : cps::PostedAsynchronousContinuation( caller, callback), target(target) {} @@ -181,7 +181,7 @@ void ComponentThread::cleanup(void) void PuppetThread::joltThreadReq( const std::shared_ptr& selfPtr, - Callback callback) + cps::Callback callback) { /** EXPLANATION: * We can't use shared_from_this() here because JOLTing occurs prior to @@ -216,7 +216,7 @@ void PuppetThread::joltThreadReq( } // Thread management method implementations -void PuppetThread::startThreadReq(Callback callback) +void PuppetThread::startThreadReq(cps::Callback callback) { std::shared_ptr caller = getSelf(); auto request = std::make_shared( @@ -229,7 +229,7 @@ void PuppetThread::startThreadReq(Callback callback) request.get(), request))); } -void PuppetThread::exitThreadReq(Callback callback) +void PuppetThread::exitThreadReq(cps::Callback callback) { std::shared_ptr caller = getSelf(); auto request = std::make_shared( @@ -247,7 +247,7 @@ void PuppetThread::exitThreadReq(Callback callback) request.get(), request))); } -void PuppetThread::pauseThreadReq(Callback callback) +void PuppetThread::pauseThreadReq(cps::Callback callback) { if (id == sscl::pptr::puppeteerThreadId) { @@ -266,7 +266,7 @@ void PuppetThread::pauseThreadReq(Callback callback) request.get(), request))); } -void PuppetThread::resumeThreadReq(Callback callback) +void PuppetThread::resumeThreadReq(cps::Callback callback) { if (id == sscl::pptr::puppeteerThreadId) { diff --git a/src/lockerAndInvokerBase.cpp b/src/lockerAndInvokerBase.cpp index 47df4a1..dde3779 100644 --- a/src/lockerAndInvokerBase.cpp +++ b/src/lockerAndInvokerBase.cpp @@ -1,5 +1,5 @@ -#include +#include -namespace sscl { +namespace sscl::cps { -} // namespace sscl +} // namespace sscl::cps diff --git a/src/puppetApplication.cpp b/src/puppetApplication.cpp index b243a44..d5836eb 100644 --- a/src/puppetApplication.cpp +++ b/src/puppetApplication.cpp @@ -1,7 +1,7 @@ #include -#include +#include #include -#include +#include #include #include @@ -14,13 +14,13 @@ PuppetApplication::PuppetApplication( } class PuppetApplication::PuppetThreadLifetimeMgmtOp -: public NonPostedAsynchronousContinuation +: public cps::NonPostedAsynchronousContinuation { public: PuppetThreadLifetimeMgmtOp( PuppetApplication &parent, unsigned int nThreads, - Callback callback) - : NonPostedAsynchronousContinuation(callback), + cps::Callback callback) + : cps::NonPostedAsynchronousContinuation(callback), loop(nThreads), parent(parent) {} @@ -73,7 +73,7 @@ public: }; void PuppetApplication::joltAllPuppetThreadsReq( - Callback callback + cps::Callback callback ) { if (threadsHaveBeenJolted) @@ -107,7 +107,7 @@ void PuppetApplication::joltAllPuppetThreadsReq( } void PuppetApplication::startAllPuppetThreadsReq( - Callback callback + cps::Callback callback ) { // If no threads, call callback immediately @@ -131,7 +131,7 @@ void PuppetApplication::startAllPuppetThreadsReq( } void PuppetApplication::pauseAllPuppetThreadsReq( - Callback callback + cps::Callback callback ) { // If no threads, call callback immediately @@ -155,7 +155,7 @@ void PuppetApplication::pauseAllPuppetThreadsReq( } void PuppetApplication::resumeAllPuppetThreadsReq( - Callback callback + cps::Callback callback ) { // If no threads, call callback immediately @@ -179,7 +179,7 @@ void PuppetApplication::resumeAllPuppetThreadsReq( } void PuppetApplication::exitAllPuppetThreadsReq( - Callback callback + cps::Callback callback ) { // If no threads, call callback immediately diff --git a/src/qutex.cpp b/src/qutex.cpp index 070773c..ad1eba8 100644 --- a/src/qutex.cpp +++ b/src/qutex.cpp @@ -1,7 +1,7 @@ -#include -#include +#include +#include -namespace sscl { +namespace sscl::cps { bool Qutex::tryAcquire( const LockerAndInvokerBase &tryingLockvoker, int nRequiredLocks @@ -377,4 +377,4 @@ void Qutex::release() front->awaken(); } -} // namespace sscl +} // namespace sscl::cps diff --git a/src/qutexAcquisitionHistoryTracker.cpp b/src/qutexAcquisitionHistoryTracker.cpp index 4731ca0..44d67fd 100644 --- a/src/qutexAcquisitionHistoryTracker.cpp +++ b/src/qutexAcquisitionHistoryTracker.cpp @@ -1,14 +1,14 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include #include -namespace sscl { +namespace sscl::cps { void DependencyGraph::addNode(const Node& node) { @@ -390,4 +390,4 @@ bool QutexAcquisitionHistoryTracker return true; } -} // namespace sscl +} // namespace sscl::cps