Spinscale: create new namespace sscl
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <atomic>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
class AsynchronousBridge
|
||||
{
|
||||
@@ -53,6 +53,6 @@ private:
|
||||
boost::asio::io_service &io_service;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // ASYNCHRONOUS_BRIDGE_H
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <spinscale/asynchronousContinuationChainLink.h>
|
||||
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
/**
|
||||
* AsynchronousContinuation - Template base class for async sequence management
|
||||
@@ -153,6 +153,6 @@ public:
|
||||
std::shared_ptr<ComponentThread> caller;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // ASYNCHRONOUS_CONTINUATION_H
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
/**
|
||||
* @brief Base class for all asynchronous continuation chain links
|
||||
@@ -27,6 +27,6 @@ public:
|
||||
getCallersContinuationShPtr() const = 0;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // ASYNCHRONOUS_CONTINUATION_CHAIN_LINK_H
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
class AsynchronousLoop
|
||||
{
|
||||
@@ -64,6 +64,6 @@ public:
|
||||
std::atomic<unsigned int> nSucceeded, nFailed;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // ASYNCHRONOUS_LOOP_H
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// The code will check for OPTS_H define to see if opts.h has been included
|
||||
class OptionParser;
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
/**
|
||||
* @brief CallableTracer - Wraps callables with metadata for debugging
|
||||
@@ -85,7 +85,7 @@ private:
|
||||
std::function<void()> callable;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
/**
|
||||
* @brief STC - SMO Traceable Callable macro
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
// Forward declaration
|
||||
class AsynchronousContinuationChainLink;
|
||||
@@ -26,6 +26,6 @@ public:
|
||||
CbFnT callbackFn;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // SPINSCALE_CALLBACK_H
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <spinscale/callback.h>
|
||||
#include <spinscale/puppetApplication.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
class ComponentThread;
|
||||
|
||||
@@ -36,6 +36,6 @@ public:
|
||||
PuppetApplication &parent;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // COMPONENT_H
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
class MarionetteThread;
|
||||
class PuppetThread;
|
||||
@@ -148,17 +148,19 @@ public:
|
||||
class ThreadLifetimeMgmtOp;
|
||||
};
|
||||
|
||||
namespace mrntt {
|
||||
extern std::shared_ptr<MarionetteThread> thread;
|
||||
} // namespace mrntt
|
||||
} // namespace sscl
|
||||
|
||||
namespace smo {
|
||||
namespace mrntt {
|
||||
extern std::shared_ptr<sscl::MarionetteThread> thread;
|
||||
} // namespace mrntt
|
||||
} // namespace smo
|
||||
|
||||
// Forward declaration for spinscale namespace functions and variables
|
||||
// Must be after smo namespace so ThreadId is defined
|
||||
namespace spinscale {
|
||||
extern smo::ThreadId marionetteThreadId;
|
||||
void setMarionetteThreadId(smo::ThreadId id);
|
||||
// Forward declaration for sscl namespace functions and variables
|
||||
// Must be after sscl namespace so ThreadId is defined
|
||||
namespace sscl {
|
||||
extern sscl::ThreadId marionetteThreadId;
|
||||
void setMarionetteThreadId(sscl::ThreadId id);
|
||||
}
|
||||
|
||||
#endif // COMPONENT_THREAD_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
// Forward declarations
|
||||
class AsynchronousContinuationChainLink;
|
||||
@@ -80,6 +80,6 @@ private:
|
||||
AdjacencyList adjacencyList;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // DEPENDENCY_GRAPH_H
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <spinscale/qutex.h>
|
||||
#include <spinscale/lockerAndInvokerBase.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
// Forward declarations
|
||||
template <class OriginalCbFnT>
|
||||
@@ -255,6 +255,6 @@ private:
|
||||
bool allLocksAcquired, registeredInQutexQueues;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // LOCK_SET_H
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
// Forward declaration
|
||||
class Qutex;
|
||||
@@ -82,6 +82,6 @@ protected:
|
||||
const void* serializedContinuationVaddr;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // LOCKER_AND_INVOKER_BASE_H
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <spinscale/callback.h>
|
||||
#include <spinscale/componentThread.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
class PuppetApplication
|
||||
: public std::enable_shared_from_this<PuppetApplication>
|
||||
@@ -63,6 +63,6 @@ private:
|
||||
class PuppetThreadLifetimeMgmtOp;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // PUPPET_APPLICATION_H
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <spinscale/spinLock.h>
|
||||
#include <spinscale/lockerAndInvokerBase.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
/**
|
||||
* @brief Qutex - Queue-based mutex for asynchronous lock management
|
||||
@@ -102,6 +102,6 @@ public:
|
||||
bool isOwned;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // QUTEX_H
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "spinLock.h"
|
||||
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
// Forward declarations
|
||||
class Qutex;
|
||||
@@ -159,6 +159,6 @@ private:
|
||||
AcquisitionHistoryMap acquisitionHistory;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // QUTEX_ACQUISITION_HISTORY_TRACKER_H
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <spinscale/callback.h>
|
||||
#include <spinscale/qutexAcquisitionHistoryTracker.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
template <class OriginalCbFnT>
|
||||
class SerializedAsynchronousContinuation
|
||||
@@ -583,6 +583,6 @@ void SerializedAsynchronousContinuation<OriginalCbFnT>
|
||||
invocationTarget();
|
||||
}
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // SERIALIZED_ASYNCHRONOUS_CONTINUATION_H
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
/**
|
||||
* @brief Simple spinlock using std::atomic
|
||||
@@ -116,6 +116,6 @@ private:
|
||||
std::atomic<bool> locked;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
#endif // SPIN_LOCK_H
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <spinscale/puppetApplication.h>
|
||||
#include <marionette/marionette.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
Component::Component(const std::shared_ptr<ComponentThread> &thread)
|
||||
: thread(thread)
|
||||
@@ -16,14 +16,16 @@ parent(parent)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace sscl
|
||||
|
||||
namespace smo {
|
||||
namespace mrntt {
|
||||
|
||||
MarionetteComponent::MarionetteComponent(
|
||||
const std::shared_ptr<ComponentThread> &thread)
|
||||
: Component(thread)
|
||||
const std::shared_ptr<sscl::ComponentThread> &thread)
|
||||
: sscl::Component(thread)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace mrntt
|
||||
|
||||
} // namespace smo
|
||||
|
||||
@@ -11,27 +11,27 @@
|
||||
#include <componentThread.h>
|
||||
#include <marionette/marionette.h>
|
||||
|
||||
namespace spinscale {
|
||||
namespace sscl {
|
||||
|
||||
// Global variable to store the marionette thread ID
|
||||
// Default value is 0, but should be set by application code via setMarionetteThreadId()
|
||||
smo::ThreadId marionetteThreadId = 0;
|
||||
sscl::ThreadId marionetteThreadId = 0;
|
||||
|
||||
void setMarionetteThreadId(smo::ThreadId id)
|
||||
void setMarionetteThreadId(sscl::ThreadId id)
|
||||
{
|
||||
marionetteThreadId = id;
|
||||
}
|
||||
|
||||
} // namespace spinscale
|
||||
} // namespace sscl
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
thread_local std::shared_ptr<ComponentThread> thisComponentThread;
|
||||
|
||||
// Implementation of static method
|
||||
std::shared_ptr<MarionetteThread> ComponentThread::getMrntt()
|
||||
{
|
||||
return mrntt::thread;
|
||||
return smo::mrntt::thread;
|
||||
}
|
||||
|
||||
void MarionetteThread::initializeTls(void)
|
||||
@@ -179,13 +179,13 @@ void PuppetThread::joltThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||
* the operation is posted to this thread's io_service (which is a member
|
||||
* of this object), the object must be alive when the operation executes.
|
||||
*/
|
||||
if (id == spinscale::marionetteThreadId)
|
||||
if (id == sscl::marionetteThreadId)
|
||||
{
|
||||
throw std::runtime_error(std::string(__func__)
|
||||
+ ": invoked on mrntt thread");
|
||||
}
|
||||
|
||||
std::shared_ptr<MarionetteThread> mrntt = mrntt::thread;
|
||||
std::shared_ptr<MarionetteThread> mrntt = smo::mrntt::thread;
|
||||
|
||||
auto request = std::make_shared<ThreadLifetimeMgmtOp>(
|
||||
mrntt, *this, callback);
|
||||
@@ -228,7 +228,7 @@ void PuppetThread::exitThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||
|
||||
void PuppetThread::pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||
{
|
||||
if (id == spinscale::marionetteThreadId)
|
||||
if (id == sscl::marionetteThreadId)
|
||||
{
|
||||
throw std::runtime_error(std::string(__func__)
|
||||
+ ": invoked on mrntt thread");
|
||||
@@ -246,7 +246,7 @@ void PuppetThread::pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||
|
||||
void PuppetThread::resumeThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||
{
|
||||
if (id == spinscale::marionetteThreadId)
|
||||
if (id == sscl::marionetteThreadId)
|
||||
{
|
||||
throw std::runtime_error(std::string(__func__)
|
||||
+ ": invoked on mrntt thread");
|
||||
@@ -310,4 +310,4 @@ void PuppetThread::pinToCpu(int cpuId)
|
||||
pinnedCpuId = cpuId;
|
||||
}
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <spinscale/lockerAndInvokerBase.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <spinscale/puppetApplication.h>
|
||||
#include <spinscale/componentThread.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
PuppetApplication::PuppetApplication(
|
||||
const std::vector<std::shared_ptr<PuppetThread>> &threads)
|
||||
@@ -218,4 +218,4 @@ void PuppetApplication::distributeAndPinThreadsAcrossCpus()
|
||||
<< "across " << cpuCount << " CPUs\n";
|
||||
}
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <spinscale/qutex.h>
|
||||
#include <spinscale/lockerAndInvokerBase.h>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
bool Qutex::tryAcquire(
|
||||
const LockerAndInvokerBase &tryingLockvoker, int nRequiredLocks
|
||||
@@ -377,4 +377,4 @@ void Qutex::release()
|
||||
front.awaken();
|
||||
}
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
namespace smo {
|
||||
namespace sscl {
|
||||
|
||||
void DependencyGraph::addNode(const Node& node)
|
||||
{
|
||||
@@ -390,4 +390,4 @@ bool QutexAcquisitionHistoryTracker
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace smo
|
||||
} // namespace sscl
|
||||
|
||||
Reference in New Issue
Block a user