mirror of
https://github.com/latentPrion/libspinscale.git
synced 2026-06-23 19:48:32 +00:00
Compare commits
2 Commits
1d1cb099db
...
e94aaf9323
| Author | SHA1 | Date | |
|---|---|---|---|
| e94aaf9323 | |||
| 83ad680c68 |
@@ -4,7 +4,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <spinscale/callback.h>
|
#include <spinscale/cps/callback.h>
|
||||||
#include <spinscale/puppetApplication.h>
|
#include <spinscale/puppetApplication.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <spinscale/callback.h>
|
#include <spinscale/cps/callback.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -162,10 +162,10 @@ public:
|
|||||||
|
|
||||||
// Thread management methods
|
// Thread management methods
|
||||||
typedef std::function<void()> threadLifetimeMgmtOpCbFn;
|
typedef std::function<void()> threadLifetimeMgmtOpCbFn;
|
||||||
void startThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
|
void startThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback);
|
||||||
void exitThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
|
void exitThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback);
|
||||||
void pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
|
void pauseThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback);
|
||||||
void resumeThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback);
|
void resumeThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JOLTs this thread to begin processing after global initialization.
|
* JOLTs this thread to begin processing after global initialization.
|
||||||
@@ -180,7 +180,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void joltThreadReq(
|
void joltThreadReq(
|
||||||
const std::shared_ptr<PuppetThread>& selfPtr,
|
const std::shared_ptr<PuppetThread>& selfPtr,
|
||||||
Callback<threadLifetimeMgmtOpCbFn> callback);
|
cps::Callback<threadLifetimeMgmtOpCbFn> callback);
|
||||||
|
|
||||||
// CPU management methods
|
// CPU management methods
|
||||||
void pinToCpu(int cpuId);
|
void pinToCpu(int cpuId);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_service.hpp>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
class AsynchronousBridge
|
class AsynchronousBridge
|
||||||
{
|
{
|
||||||
@@ -53,6 +53,6 @@ private:
|
|||||||
boost::asio::io_service &io_service;
|
boost::asio::io_service &io_service;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // ASYNCHRONOUS_BRIDGE_H
|
#endif // ASYNCHRONOUS_BRIDGE_H
|
||||||
+7
-7
@@ -5,12 +5,12 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <spinscale/componentThread.h>
|
#include <spinscale/componentThread.h>
|
||||||
#include <spinscale/callback.h>
|
#include <spinscale/cps/callback.h>
|
||||||
#include <spinscale/callableTracer.h>
|
#include <spinscale/cps/callableTracer.h>
|
||||||
#include <spinscale/asynchronousContinuationChainLink.h>
|
#include <spinscale/cps/asynchronousContinuationChainLink.h>
|
||||||
|
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AsynchronousContinuation - Template base class for async sequence management
|
* AsynchronousContinuation - Template base class for async sequence management
|
||||||
@@ -129,7 +129,7 @@ class PostedAsynchronousContinuation
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PostedAsynchronousContinuation(
|
PostedAsynchronousContinuation(
|
||||||
const std::shared_ptr<ComponentThread> &caller,
|
const std::shared_ptr<sscl::ComponentThread> &caller,
|
||||||
Callback<OriginalCbFnT> originalCbFn)
|
Callback<OriginalCbFnT> originalCbFn)
|
||||||
: AsynchronousContinuation<OriginalCbFnT>(originalCbFn),
|
: AsynchronousContinuation<OriginalCbFnT>(originalCbFn),
|
||||||
caller(caller)
|
caller(caller)
|
||||||
@@ -150,9 +150,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<ComponentThread> caller;
|
std::shared_ptr<sscl::ComponentThread> caller;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // ASYNCHRONOUS_CONTINUATION_H
|
#endif // ASYNCHRONOUS_CONTINUATION_H
|
||||||
+4
-4
@@ -4,10 +4,10 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <vector>
|
|
||||||
#include <spinscale/lockSet.h>
|
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
|
class LockSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Base class for all asynchronous continuation chain links
|
* @brief Base class for all asynchronous continuation chain links
|
||||||
@@ -38,6 +38,6 @@ public:
|
|||||||
{ return std::nullopt; }
|
{ return std::nullopt; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // ASYNCHRONOUS_CONTINUATION_CHAIN_LINK_H
|
#endif // ASYNCHRONOUS_CONTINUATION_CHAIN_LINK_H
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <spinscale/componentThread.h>
|
#include <spinscale/componentThread.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CallableTracer - Wraps callables with metadata for debugging
|
* @brief CallableTracer - Wraps callables with metadata for debugging
|
||||||
@@ -49,8 +49,8 @@ public:
|
|||||||
if (optTraceCallables)
|
if (optTraceCallables)
|
||||||
{
|
{
|
||||||
std::cout << "" << __func__ << ": On thread "
|
std::cout << "" << __func__ << ": On thread "
|
||||||
<< (ComponentThread::tlsInitialized()
|
<< (sscl::ComponentThread::tlsInitialized()
|
||||||
? ComponentThread::getSelf()->name : "<TLS un-init'ed>")
|
? sscl::ComponentThread::getSelf()->name : "<TLS un-init'ed>")
|
||||||
<< ": Calling callable posted by:\n"
|
<< ": Calling callable posted by:\n"
|
||||||
<< "\t" << callerFuncName << "\n\tat line " << (int)callerLine
|
<< "\t" << callerFuncName << "\n\tat line " << (int)callerLine
|
||||||
<< " return addr 0: " << returnAddr0
|
<< " return addr 0: " << returnAddr0
|
||||||
@@ -79,7 +79,7 @@ private:
|
|||||||
std::function<void()> callable;
|
std::function<void()> callable;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief STC - SMO Traceable Callable macro
|
* @brief STC - SMO Traceable Callable macro
|
||||||
@@ -109,7 +109,7 @@ private:
|
|||||||
// e.g., "void smo::SomeClass::method(int, int)"
|
// e.g., "void smo::SomeClass::method(int, int)"
|
||||||
// __builtin_return_address(0) = direct caller
|
// __builtin_return_address(0) = direct caller
|
||||||
// __builtin_return_address(1) = caller before that
|
// __builtin_return_address(1) = caller before that
|
||||||
#define STC(arg) sscl::CallableTracer( \
|
#define STC(arg) sscl::cps::CallableTracer( \
|
||||||
__PRETTY_FUNCTION__, \
|
__PRETTY_FUNCTION__, \
|
||||||
__LINE__, \
|
__LINE__, \
|
||||||
__builtin_return_address(0), \
|
__builtin_return_address(0), \
|
||||||
@@ -120,7 +120,7 @@ private:
|
|||||||
// e.g., "void __cdecl smo::SomeClass::method(int, int)"
|
// e.g., "void __cdecl smo::SomeClass::method(int, int)"
|
||||||
// _ReturnAddress() = direct caller (only one level available)
|
// _ReturnAddress() = direct caller (only one level available)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#define STC(arg) sscl::CallableTracer( \
|
#define STC(arg) sscl::cps::CallableTracer( \
|
||||||
__FUNCSIG__, \
|
__FUNCSIG__, \
|
||||||
__LINE__, \
|
__LINE__, \
|
||||||
_ReturnAddress(), \
|
_ReturnAddress(), \
|
||||||
@@ -129,7 +129,7 @@ private:
|
|||||||
#else
|
#else
|
||||||
// Fallback to standard __func__ (unqualified name only)
|
// Fallback to standard __func__ (unqualified name only)
|
||||||
// No return address support
|
// No return address support
|
||||||
#define STC(arg) sscl::CallableTracer( \
|
#define STC(arg) sscl::cps::CallableTracer( \
|
||||||
__func__, \
|
__func__, \
|
||||||
__LINE__, \
|
__LINE__, \
|
||||||
nullptr, \
|
nullptr, \
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
class AsynchronousContinuationChainLink;
|
class AsynchronousContinuationChainLink;
|
||||||
@@ -26,6 +26,6 @@ public:
|
|||||||
CbFnT callbackFn;
|
CbFnT callbackFn;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // SPINSCALE_CALLBACK_H
|
#endif // SPINSCALE_CALLBACK_H
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
class AsynchronousContinuationChainLink;
|
class AsynchronousContinuationChainLink;
|
||||||
@@ -80,6 +80,6 @@ private:
|
|||||||
AdjacencyList adjacencyList;
|
AdjacencyList adjacencyList;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // DEPENDENCY_GRAPH_H
|
#endif // DEPENDENCY_GRAPH_H
|
||||||
@@ -6,10 +6,10 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <spinscale/qutex.h>
|
#include <spinscale/cps/qutex.h>
|
||||||
#include <spinscale/lockerAndInvokerBase.h>
|
#include <spinscale/cps/lockerAndInvokerBase.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
class Qutex;
|
class Qutex;
|
||||||
|
|
||||||
@@ -280,6 +280,6 @@ private:
|
|||||||
bool allLocksAcquired, registeredInQutexQueues;
|
bool allLocksAcquired, registeredInQutexQueues;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // LOCK_SET_H
|
#endif // LOCK_SET_H
|
||||||
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
class Qutex;
|
class Qutex;
|
||||||
@@ -82,6 +82,6 @@ protected:
|
|||||||
const void* serializedContinuationVaddr;
|
const void* serializedContinuationVaddr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // LOCKER_AND_INVOKER_BASE_H
|
#endif // LOCKER_AND_INVOKER_BASE_H
|
||||||
@@ -6,9 +6,9 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <spinscale/spinLock.h>
|
#include <spinscale/spinLock.h>
|
||||||
#include <spinscale/lockerAndInvokerBase.h>
|
#include <spinscale/cps/lockerAndInvokerBase.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Qutex - Queue-based mutex for asynchronous lock management
|
* @brief Qutex - Queue-based mutex for asynchronous lock management
|
||||||
@@ -97,11 +97,11 @@ public:
|
|||||||
std::string name;
|
std::string name;
|
||||||
std::shared_ptr<LockerAndInvokerBase> currOwner;
|
std::shared_ptr<LockerAndInvokerBase> currOwner;
|
||||||
#endif
|
#endif
|
||||||
SpinLock lock;
|
sscl::SpinLock lock;
|
||||||
LockerAndInvokerBase::List queue;
|
LockerAndInvokerBase::List queue;
|
||||||
bool isOwned;
|
bool isOwned;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // QUTEX_H
|
#endif // QUTEX_H
|
||||||
+4
-4
@@ -5,10 +5,10 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <forward_list>
|
#include <forward_list>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "spinLock.h"
|
#include <spinscale/spinLock.h>
|
||||||
|
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
class Qutex;
|
class Qutex;
|
||||||
@@ -155,10 +155,10 @@ private:
|
|||||||
* Therefore, it's best to use a SpinLock on the history class to avoid
|
* Therefore, it's best to use a SpinLock on the history class to avoid
|
||||||
* these coupling issues.
|
* these coupling issues.
|
||||||
*/
|
*/
|
||||||
SpinLock acquisitionHistoryLock;
|
sscl::SpinLock acquisitionHistoryLock;
|
||||||
AcquisitionHistoryMap acquisitionHistory;
|
AcquisitionHistoryMap acquisitionHistory;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // QUTEX_ACQUISITION_HISTORY_TRACKER_H
|
#endif // QUTEX_ACQUISITION_HISTORY_TRACKER_H
|
||||||
+11
-11
@@ -8,13 +8,13 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <spinscale/componentThread.h>
|
#include <spinscale/componentThread.h>
|
||||||
#include <spinscale/lockSet.h>
|
#include <spinscale/cps/lockSet.h>
|
||||||
#include <spinscale/asynchronousContinuation.h>
|
#include <spinscale/cps/asynchronousContinuation.h>
|
||||||
#include <spinscale/lockerAndInvokerBase.h>
|
#include <spinscale/cps/lockerAndInvokerBase.h>
|
||||||
#include <spinscale/callback.h>
|
#include <spinscale/cps/callback.h>
|
||||||
#include <spinscale/qutexAcquisitionHistoryTracker.h>
|
#include <spinscale/cps/qutexAcquisitionHistoryTracker.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
template <class OriginalCbFnT>
|
template <class OriginalCbFnT>
|
||||||
class SerializedAsynchronousContinuation
|
class SerializedAsynchronousContinuation
|
||||||
@@ -22,7 +22,7 @@ class SerializedAsynchronousContinuation
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SerializedAsynchronousContinuation(
|
SerializedAsynchronousContinuation(
|
||||||
const std::shared_ptr<ComponentThread> &caller,
|
const std::shared_ptr<sscl::ComponentThread> &caller,
|
||||||
Callback<OriginalCbFnT> originalCbFn,
|
Callback<OriginalCbFnT> originalCbFn,
|
||||||
std::vector<std::reference_wrapper<Qutex>> requiredLocks)
|
std::vector<std::reference_wrapper<Qutex>> requiredLocks)
|
||||||
: PostedAsynchronousContinuation<OriginalCbFnT>(caller, originalCbFn),
|
: PostedAsynchronousContinuation<OriginalCbFnT>(caller, originalCbFn),
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
LockerAndInvoker(
|
LockerAndInvoker(
|
||||||
SerializedAsynchronousContinuation<OriginalCbFnT>
|
SerializedAsynchronousContinuation<OriginalCbFnT>
|
||||||
&serializedContinuation,
|
&serializedContinuation,
|
||||||
const std::shared_ptr<ComponentThread>& target,
|
const std::shared_ptr<sscl::ComponentThread>& target,
|
||||||
InvocationTargetT invocationTarget)
|
InvocationTargetT invocationTarget)
|
||||||
: LockerAndInvokerBase(&serializedContinuation),
|
: LockerAndInvokerBase(&serializedContinuation),
|
||||||
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
#ifdef CONFIG_ENABLE_DEBUG_LOCKS
|
||||||
@@ -266,7 +266,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
SerializedAsynchronousContinuation<OriginalCbFnT>
|
SerializedAsynchronousContinuation<OriginalCbFnT>
|
||||||
&serializedContinuation;
|
&serializedContinuation;
|
||||||
std::shared_ptr<ComponentThread> target;
|
std::shared_ptr<sscl::ComponentThread> target;
|
||||||
InvocationTargetT invocationTarget;
|
InvocationTargetT invocationTarget;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -470,7 +470,7 @@ template <class InvocationTargetT>
|
|||||||
void SerializedAsynchronousContinuation<OriginalCbFnT>
|
void SerializedAsynchronousContinuation<OriginalCbFnT>
|
||||||
::LockerAndInvoker<InvocationTargetT>::operator()()
|
::LockerAndInvoker<InvocationTargetT>::operator()()
|
||||||
{
|
{
|
||||||
if (ComponentThread::getSelf() != target)
|
if (sscl::ComponentThread::getSelf() != target)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
"LockerAndInvoker::operator(): Thread safety violation - "
|
"LockerAndInvoker::operator(): Thread safety violation - "
|
||||||
@@ -588,6 +588,6 @@ void SerializedAsynchronousContinuation<OriginalCbFnT>
|
|||||||
invocationTarget();
|
invocationTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|
||||||
#endif // SERIALIZED_ASYNCHRONOUS_CONTINUATION_H
|
#endif // SERIALIZED_ASYNCHRONOUS_CONTINUATION_H
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <spinscale/callback.h>
|
#include <spinscale/cps/callback.h>
|
||||||
#include <spinscale/componentThread.h>
|
#include <spinscale/componentThread.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl {
|
||||||
@@ -21,15 +21,15 @@ public:
|
|||||||
// Thread management methods
|
// Thread management methods
|
||||||
typedef std::function<void()> puppetThreadLifetimeMgmtOpCbFn;
|
typedef std::function<void()> puppetThreadLifetimeMgmtOpCbFn;
|
||||||
void joltAllPuppetThreadsReq(
|
void joltAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
||||||
void startAllPuppetThreadsReq(
|
void startAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
||||||
void pauseAllPuppetThreadsReq(
|
void pauseAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
||||||
void resumeAllPuppetThreadsReq(
|
void resumeAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
||||||
void exitAllPuppetThreadsReq(
|
void exitAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback);
|
||||||
|
|
||||||
// CPU distribution method
|
// CPU distribution method
|
||||||
void distributeAndPinThreadsAcrossCpus();
|
void distributeAndPinThreadsAcrossCpus();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <spinscale/callableTracer.h>
|
#include <spinscale/cps/callableTracer.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
bool CallableTracer::optTraceCallables = false;
|
bool CallableTracer::optTraceCallables = false;
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|||||||
+11
-11
@@ -5,9 +5,9 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_service.hpp>
|
||||||
#include <spinscale/asynchronousContinuation.h>
|
#include <spinscale/cps/asynchronousContinuation.h>
|
||||||
#include <spinscale/callback.h>
|
#include <spinscale/cps/callback.h>
|
||||||
#include <spinscale/callableTracer.h>
|
#include <spinscale/cps/callableTracer.h>
|
||||||
#include <spinscale/component.h>
|
#include <spinscale/component.h>
|
||||||
#include <spinscale/componentThread.h>
|
#include <spinscale/componentThread.h>
|
||||||
|
|
||||||
@@ -79,14 +79,14 @@ const std::shared_ptr<ComponentThread> ComponentThread::getSelf(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PuppetThread::ThreadLifetimeMgmtOp
|
class PuppetThread::ThreadLifetimeMgmtOp
|
||||||
: public PostedAsynchronousContinuation<threadLifetimeMgmtOpCbFn>
|
: public cps::PostedAsynchronousContinuation<threadLifetimeMgmtOpCbFn>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ThreadLifetimeMgmtOp(
|
ThreadLifetimeMgmtOp(
|
||||||
const std::shared_ptr<ComponentThread> &caller,
|
const std::shared_ptr<ComponentThread> &caller,
|
||||||
const std::shared_ptr<PuppetThread> &target,
|
const std::shared_ptr<PuppetThread> &target,
|
||||||
Callback<threadLifetimeMgmtOpCbFn> callback)
|
cps::Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||||
: PostedAsynchronousContinuation<threadLifetimeMgmtOpCbFn>(
|
: cps::PostedAsynchronousContinuation<threadLifetimeMgmtOpCbFn>(
|
||||||
caller, callback),
|
caller, callback),
|
||||||
target(target)
|
target(target)
|
||||||
{}
|
{}
|
||||||
@@ -181,7 +181,7 @@ void ComponentThread::cleanup(void)
|
|||||||
|
|
||||||
void PuppetThread::joltThreadReq(
|
void PuppetThread::joltThreadReq(
|
||||||
const std::shared_ptr<PuppetThread>& selfPtr,
|
const std::shared_ptr<PuppetThread>& selfPtr,
|
||||||
Callback<threadLifetimeMgmtOpCbFn> callback)
|
cps::Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||||
{
|
{
|
||||||
/** EXPLANATION:
|
/** EXPLANATION:
|
||||||
* We can't use shared_from_this() here because JOLTing occurs prior to
|
* We can't use shared_from_this() here because JOLTing occurs prior to
|
||||||
@@ -216,7 +216,7 @@ void PuppetThread::joltThreadReq(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Thread management method implementations
|
// Thread management method implementations
|
||||||
void PuppetThread::startThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
void PuppetThread::startThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||||
{
|
{
|
||||||
std::shared_ptr<ComponentThread> caller = getSelf();
|
std::shared_ptr<ComponentThread> caller = getSelf();
|
||||||
auto request = std::make_shared<ThreadLifetimeMgmtOp>(
|
auto request = std::make_shared<ThreadLifetimeMgmtOp>(
|
||||||
@@ -229,7 +229,7 @@ void PuppetThread::startThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
|||||||
request.get(), request)));
|
request.get(), request)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PuppetThread::exitThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
void PuppetThread::exitThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||||
{
|
{
|
||||||
std::shared_ptr<ComponentThread> caller = getSelf();
|
std::shared_ptr<ComponentThread> caller = getSelf();
|
||||||
auto request = std::make_shared<ThreadLifetimeMgmtOp>(
|
auto request = std::make_shared<ThreadLifetimeMgmtOp>(
|
||||||
@@ -247,7 +247,7 @@ void PuppetThread::exitThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
|||||||
request.get(), request)));
|
request.get(), request)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PuppetThread::pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
void PuppetThread::pauseThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||||
{
|
{
|
||||||
if (id == sscl::pptr::puppeteerThreadId)
|
if (id == sscl::pptr::puppeteerThreadId)
|
||||||
{
|
{
|
||||||
@@ -266,7 +266,7 @@ void PuppetThread::pauseThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
|||||||
request.get(), request)));
|
request.get(), request)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PuppetThread::resumeThreadReq(Callback<threadLifetimeMgmtOpCbFn> callback)
|
void PuppetThread::resumeThreadReq(cps::Callback<threadLifetimeMgmtOpCbFn> callback)
|
||||||
{
|
{
|
||||||
if (id == sscl::pptr::puppeteerThreadId)
|
if (id == sscl::pptr::puppeteerThreadId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <spinscale/lockerAndInvokerBase.h>
|
#include <spinscale/cps/lockerAndInvokerBase.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|||||||
+10
-10
@@ -1,7 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <spinscale/asynchronousContinuation.h>
|
#include <spinscale/cps/asynchronousContinuation.h>
|
||||||
#include <spinscale/asynchronousLoop.h>
|
#include <spinscale/asynchronousLoop.h>
|
||||||
#include <spinscale/callback.h>
|
#include <spinscale/cps/callback.h>
|
||||||
#include <spinscale/puppetApplication.h>
|
#include <spinscale/puppetApplication.h>
|
||||||
#include <spinscale/componentThread.h>
|
#include <spinscale/componentThread.h>
|
||||||
|
|
||||||
@@ -14,13 +14,13 @@ PuppetApplication::PuppetApplication(
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PuppetApplication::PuppetThreadLifetimeMgmtOp
|
class PuppetApplication::PuppetThreadLifetimeMgmtOp
|
||||||
: public NonPostedAsynchronousContinuation<puppetThreadLifetimeMgmtOpCbFn>
|
: public cps::NonPostedAsynchronousContinuation<puppetThreadLifetimeMgmtOpCbFn>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PuppetThreadLifetimeMgmtOp(
|
PuppetThreadLifetimeMgmtOp(
|
||||||
PuppetApplication &parent, unsigned int nThreads,
|
PuppetApplication &parent, unsigned int nThreads,
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback)
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback)
|
||||||
: NonPostedAsynchronousContinuation<puppetThreadLifetimeMgmtOpCbFn>(callback),
|
: cps::NonPostedAsynchronousContinuation<puppetThreadLifetimeMgmtOpCbFn>(callback),
|
||||||
loop(nThreads),
|
loop(nThreads),
|
||||||
parent(parent)
|
parent(parent)
|
||||||
{}
|
{}
|
||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void PuppetApplication::joltAllPuppetThreadsReq(
|
void PuppetApplication::joltAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (threadsHaveBeenJolted)
|
if (threadsHaveBeenJolted)
|
||||||
@@ -107,7 +107,7 @@ void PuppetApplication::joltAllPuppetThreadsReq(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PuppetApplication::startAllPuppetThreadsReq(
|
void PuppetApplication::startAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// If no threads, call callback immediately
|
// If no threads, call callback immediately
|
||||||
@@ -131,7 +131,7 @@ void PuppetApplication::startAllPuppetThreadsReq(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PuppetApplication::pauseAllPuppetThreadsReq(
|
void PuppetApplication::pauseAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// If no threads, call callback immediately
|
// If no threads, call callback immediately
|
||||||
@@ -155,7 +155,7 @@ void PuppetApplication::pauseAllPuppetThreadsReq(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PuppetApplication::resumeAllPuppetThreadsReq(
|
void PuppetApplication::resumeAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// If no threads, call callback immediately
|
// If no threads, call callback immediately
|
||||||
@@ -179,7 +179,7 @@ void PuppetApplication::resumeAllPuppetThreadsReq(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PuppetApplication::exitAllPuppetThreadsReq(
|
void PuppetApplication::exitAllPuppetThreadsReq(
|
||||||
Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
cps::Callback<puppetThreadLifetimeMgmtOpCbFn> callback
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// If no threads, call callback immediately
|
// If no threads, call callback immediately
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
#include <spinscale/qutex.h>
|
#include <spinscale/cps/qutex.h>
|
||||||
#include <spinscale/lockerAndInvokerBase.h>
|
#include <spinscale/cps/lockerAndInvokerBase.h>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
bool Qutex::tryAcquire(
|
bool Qutex::tryAcquire(
|
||||||
const LockerAndInvokerBase &tryingLockvoker, int nRequiredLocks
|
const LockerAndInvokerBase &tryingLockvoker, int nRequiredLocks
|
||||||
@@ -377,4 +377,4 @@ void Qutex::release()
|
|||||||
front->awaken();
|
front->awaken();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#include <spinscale/qutexAcquisitionHistoryTracker.h>
|
#include <spinscale/cps/qutexAcquisitionHistoryTracker.h>
|
||||||
#include <spinscale/serializedAsynchronousContinuation.h>
|
#include <spinscale/cps/serializedAsynchronousContinuation.h>
|
||||||
#include <spinscale/qutex.h>
|
#include <spinscale/cps/qutex.h>
|
||||||
#include <spinscale/dependencyGraph.h>
|
#include <spinscale/cps/dependencyGraph.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <forward_list>
|
#include <forward_list>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace sscl {
|
namespace sscl::cps {
|
||||||
|
|
||||||
void DependencyGraph::addNode(const Node& node)
|
void DependencyGraph::addNode(const Node& node)
|
||||||
{
|
{
|
||||||
@@ -390,4 +390,4 @@ bool QutexAcquisitionHistoryTracker
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sscl
|
} // namespace sscl::cps
|
||||||
|
|||||||
Reference in New Issue
Block a user