7 #ifndef MULTI_THREADING_MGR_H 8 #define MULTI_THREADING_MGR_H 14 #include <boost/noncopyable.hpp> 48 const Callback& entry_cb,
const Callback& exit_cb)
85 void addCallbackSet(
const std::string& name,
94 void removeCallbackSet(
const std::string& name);
100 const std::list<CSCallbackSet>& getCallbackSets();
104 std::list<CSCallbackSet> cb_sets_;
149 bool getMode()
const;
154 void setMode(
bool enabled);
168 void enterCriticalSection();
182 void exitCriticalSection();
187 bool isInCriticalSection();
197 uint32_t getThreadPoolSize()
const;
202 void setThreadPoolSize(uint32_t size);
207 uint32_t getPacketQueueSize();
212 void setPacketQueueSize(uint32_t size);
219 static uint32_t detectThreadCount();
233 void apply(
bool enabled, uint32_t thread_count, uint32_t queue_size);
247 void addCriticalSectionCallbacks(
const std::string& name,
259 void removeCriticalSectionCallbacks(
const std::string& name);
262 void removeAllCriticalSectionCallbacks();
286 void checkCallbacksPermissions();
294 void callEntryCallbacks();
302 void callExitCallbacks();
316 uint32_t critical_section_count_;
319 uint32_t thread_pool_size_;
359 #endif // MULTI_THREADING_MGR_H RAII class creating a critical section.
Callback entry_cb_
Entry point callback associated with name.
Embodies a named set of CriticalSection callbacks.
CSCallbackSet(const std::string &name, const Callback &check_cb, const Callback &entry_cb, const Callback &exit_cb)
Constructor.
CSCallbackSetList()
Constructor.
Maintains list of unique CSCallbackSets.
Defines the logger used by the top-level component of kea-lfc.
Callback exit_cb_
Exit point callback associated with name.
std::function< void()> Callback
Defines a callback as a simple void() functor.
Callback check_cb_
Check permissions callback associated with name.
std::string name_
Name by which the callback can be found.
Defines a thread pool which uses a thread pool queue for managing work items.