FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
OMEexecQueue.h
Go to the documentation of this file.
1 #ifndef _OME_EXEC_QUEUE_H
2 #define _OME_EXEC_QUEUE_H "$Id: OMEexecQueue.h 349 2020-05-21 04:19:56Z geoff $"
4 
6 #include <deque>
7 
8 #include <OMEobject.h>
9 #include <OMEthread.h>
10 
15 #define OME_MAX_PRIORITY_LEVELS 5
16 #define OME_DEFAULT_THREAD_PRIORITY 3
17 
22 private:
24  uint_fast32_t totalThreadsInQueue;
25  uint_fast8_t lastLevel; // up to OME_MAX_PRIORITY_LEVELS
26 
28 public:
31  lastLevel = 0;
32  }
33 
35 
38 
40 
41 // OME_FAST_CALL OMEthread *getNextThread(uint_fast8_t *prio = nullptr, bool restartAtTop=true);
42 
43  OME_FAST_CALL uint_fast16_t getNextThreads(OMEthread *v[],
44  const uint_fast16_t maxWanted, uint_fast8_t *prio = nullptr, bool restartAtTop=true);
45 
47 
48  OME_FAST_CALL uint_fast32_t executeSlices(const uint_fast32_t maxCount);
49 
50  OME_FAST_CALL uint_fast32_t parallelExecuteSlices(const uint_fast32_t maxCount);
51 
52  uint_fast32_t totalQueuedAtLevel(uint_fast8_t l) const OME_ALWAYS_INLINE { return (threadList[l].size()); }
53 
54  uint_fast32_t totalQueued() const OME_ALWAYS_INLINE { return (totalThreadsInQueue); }
55 
56 }; // end class OMEthreadExecQueue
57 
58 
59 // Global functions..., should these be static?
60 void OMEinitializeOIL2threadQueue(const int cpuTotal = 1, const int multiThreshold = 0);
61 
62 int OMEexecuteOIL2threads(const uint_fast32_t maxToRun);
63 
65 
67 
68 uint_fast32_t OMEwaitForThreadsToStop(uint_fast32_t maxWaitTime);
69 
72 #endif
73 /* vim: set expandtab shiftwidth=4 tabstop=4: */
OMEcallStack::thisMethod
OMEtype thisMethod
Definition: OMEthread.h:36
OMEthreadExecQueue::totalQueuedAtLevel
uint_fast32_t totalQueuedAtLevel(uint_fast8_t l) const OME_ALWAYS_INLINE
Definition: OMEexecQueue.h:52
l
Ïúíþ ð Ø ˜ ˜ __text __TEXT € __apple_names __DWARF __apple_objc __DWARF __apple_namespac__DWARF H X __apple_types __DWARF l
Definition: tmp3.o.cpp:1
OMEterminateThreadsOnObject
int OMEterminateThreadsOnObject(const OMEobject *obj)
Definition: OMEexecQueue.cpp:591
OME_THREAD_RUNNING
@ OME_THREAD_RUNNING
thread is active
Definition: OMEthread.h:21
OMEprofileCounter< uint32_t >
execProcess
int execProcess(OMEthread *thread, OMEtype &result, const OMEtype &args)
Definition: OMEexec.cpp:6
OMEexecuteOIL2threads
int OMEexecuteOIL2threads(const uint_fast32_t count)
Definition: OMEexecQueue.cpp:566
OME_MAX_PRIORITY_LEVELS
#define OME_MAX_PRIORITY_LEVELS
Definition: OMEexecQueue.h:15
OMEstartCriticalSection
void OMEstartCriticalSection(eOMEcriticalSectionLabel regionID)
Definition: OMEmutex.cpp:217
OMEinitializeOIL2threadQueue
void OMEinitializeOIL2threadQueue(const int cpuCount, const int multiThreshold)
Definition: OMEexecQueue.cpp:512
MIN_WORK_FOR_MULTI_DEFAULT
#define MIN_WORK_FOR_MULTI_DEFAULT
Definition: OMEexecQueue.cpp:32
OMEthread::getThreadState
OMEthreadStates getThreadState() const OME_ALWAYS_INLINE
Definition: OMEthread.h:119
OMEioEvents.h
OME_THREAD_TERMINATED
@ OME_THREAD_TERMINATED
thread is terminated
Definition: OMEthread.h:23
OMEruntime.h
OMEwaitForThreadsToStop
uint_fast32_t OMEwaitForThreadsToStop(uint_fast32_t maxWaitTime)
Request loiter threads to terminate and wait for them to terminate.
Definition: OMEexecQueue.cpp:485
OMEthread::getThisOID
const OMEoid & getThisOID() const OME_ALWAYS_INLINE
Definition: OMEthread.h:154
OMEsetConditionVariable
int OMEsetConditionVariable(OME_CONDITION_TYPE *var)
Definition: OMEmutex.cpp:204
OMEwaitForCondition
int OMEwaitForCondition(OME_CONDITION_TYPE *var, eOMEcriticalSectionLabel mutexID)
Definition: OMEmutex.cpp:172
OMEtype::value
union OMEtype::@26 value
OMEthreadExecQueue::totalThreadsInQueue
uint_fast32_t totalThreadsInQueue
Definition: OMEexecQueue.h:24
OMEtype
Fundamental ANY type for FARGOS/VISTA Object Management Environment.
Definition: OMEbaseType.h:250
OMEobject
Base class and abstract interface for an object within a FARGOS/VISTA Object Management Environment.
Definition: OMEobject.h:22
OMEevent.h
OMEinitConditionVariable
int OMEinitConditionVariable(OME_CONDITION_TYPE *var)
Definition: OMEmutex.cpp:130
OMEthreadExecQueue::addThreadToQueue
OME_FAST_CALL void addThreadToQueue(OMEthread *t, int prio=OME_DEFAULT_THREAD_PRIORITY)
Definition: OMEexecQueue.cpp:39
OMEthreadExecQueue::lastLevel
uint_fast8_t lastLevel
Definition: OMEexecQueue.h:25
OMEcore.h
OMEthread::outputOnStream
void outputOnStream(std::ostream &o=std::cout) const
Definition: OMEthread.cpp:1172
OMEthreadExecQueue::executeSlices
OME_FAST_CALL uint_fast32_t executeSlices(const uint_fast32_t maxCount)
Definition: OMEexecQueue.cpp:239
OMEthreadExecQueue::getNextThreads
OME_FAST_CALL uint_fast16_t getNextThreads(OMEthread *v[], const uint_fast16_t maxWanted, uint_fast8_t *prio=nullptr, bool restartAtTop=true)
Definition: OMEexecQueue.cpp:155
OMEobject.h
OME_MAX_CPUS_PERMITTED
#define OME_MAX_CPUS_PERMITTED
Definition: OMEmutex.h:79
srcID
const char srcID[]
Definition: catSym.c:17
OMEthreadExecQueue::OMEthreadExecQueue
OMEthreadExecQueue()
Definition: OMEexecQueue.h:29
OMEthread::executeSlice
void executeSlice()
Definition: OMEthread.cpp:1119
INCREMENT_COUNTER32_BY
#define INCREMENT_COUNTER32_BY(v, amt)
Definition: OMEexecQueue.cpp:14
OMEthread::terminateThread
void terminateThread()
Definition: OMEthread.cpp:1094
OMEthread.h
OMEwaitForNativeThread
int OMEwaitForNativeThread(uint64_t pid, void **retValue)
Definition: OMEmutex.cpp:312
OME_EXPECT_TRUE
#define OME_EXPECT_TRUE(expr)
Annotation macro for conditional expression expected to be true.
Definition: compiler_hints.h:541
OMEthread::callStack
OMEcallStack * callStack
Definition: OMEthread.h:74
OMEexecQueue.h
OMEthreadExecQueue::finishSlice
OME_FAST_CALL void finishSlice(OMEthread *)
Definition: OMEexecQueue.cpp:222
OMEthread::getThreadPriority
int getThreadPriority() const OME_ALWAYS_INLINE
Definition: OMEthread.h:123
OME_DEFAULT_THREAD_PRIORITY
#define OME_DEFAULT_THREAD_PRIORITY
Definition: OMEexecQueue.h:16
OME_CONDITION_TYPE
#define OME_CONDITION_TYPE
Definition: timed_mutex.hpp:18
OMEshutdown
int OMEshutdown(OMEthread *thread, OMEtype &result)
OIL2 interface routine to request shutdown of FARGOS/VISTA Object Management Environment via OMEreque...
Definition: OMEexecQueue.cpp:601
MAX_ARGS
#define MAX_ARGS
Definition: OMEexec.cpp:3
OMEthreadExecQueue::terminateThreadsOnObject
OME_FAST_CALL int terminateThreadsOnObject(const OMEobject *obj)
Definition: OMEexecQueue.cpp:82
OMEstopFlag
SMV_StandaloneNumeric< uint32_t > OMEstopFlag("stopFlag")
External flag used to trigger stop of a FARGOS/VISTA Object Management Environment.
OMEthreadExecQueue::totalQueued
uint_fast32_t totalQueued() const OME_ALWAYS_INLINE
Definition: OMEexecQueue.h:54
OME_USED
const char srcID[] OME_USED
Definition: tick_time.cpp:24
atomic_values.h
Atomic operations.
OMEdefOIL2func
Record to define the implementation of an OIL2 function.
Definition: OMEthread.h:287
OMEendCriticalSection
void OMEendCriticalSection(eOMEcriticalSectionLabel regionID)
Definition: OMEmutex.cpp:236
OMEprofileCounter::setValue
virtual void setValue(const OMEtype &newV) override
Set the variable's value.
Definition: OMEdebugInfo.h:200
OME_CRITICAL_SECTION_KERNEL_THREAD
@ OME_CRITICAL_SECTION_KERNEL_THREAD
Definition: OMEmutex.h:44
OME_EXPECT_FALSE
#define OME_EXPECT_FALSE(expr)
Annotation macro for conditional expression expected to be false.
Definition: compiler_hints.h:540
OME_ALWAYS_INLINE
#define OME_ALWAYS_INLINE
Tell the compiler to alway inline a function, regardless of optimization level.
Definition: compiler_hints.h:364
OMEthreadExecQueue::parallelExecuteSlices
OME_FAST_CALL uint_fast32_t parallelExecuteSlices(const uint_fast32_t maxCount)
Definition: OMEexecQueue.cpp:365
OMEthreadExecQueue
Implements thread queues with multiple levels of priority.
Definition: OMEexecQueue.h:21
OME_FAST_CALL
#define OME_FAST_CALL
Definition: compiler_hints.h:468
THREAD_REQUEST_COUNT
#define THREAD_REQUEST_COUNT
Definition: OMEexecQueue.cpp:31
OMEthreadExecQueue::removeSpecificThreadFromQueue
OME_FAST_CALL bool removeSpecificThreadFromQueue(OMEthread *t, int prio=-1)
Definition: OMEexecQueue.cpp:54
OMEthreadExecQueue::~OMEthreadExecQueue
~OMEthreadExecQueue()
Definition: OMEexecQueue.h:34
OMEstopLoiterThreads
void OMEstopLoiterThreads()
Definition: OMEexecQueue.cpp:469
OMErequestShutdown
void OMErequestShutdown()
Definition: OMEioEvents.cpp:572
_STD
#define _STD
Definition: OMEmanifests.h:146
OMEset::nextElement
OMEtype * nextElement()
Iterate over a set by retrieving the next element.
Definition: OMEset.cpp:280
OMEdebugInfo.h
OME debug and profiling interfaces.
OMEthread
Public interface to an OME thread.
Definition: OMEthread.h:60
LOG_ENDLINE
#define LOG_ENDLINE
Closing clause for text line output using << operators.
Definition: logging_api.hpp:2956
OMEcallWithNativeThread
uint64_t OMEcallWithNativeThread(OMEnativeTaskFP func, void *functionArg)
Definition: OMEmutex.cpp:283
OMEset::resetIterator
void resetIterator()
Reset the internal iterator to the beginning of the list.
Definition: OMEset.cpp:264
OMEtype::set
class OMEset * set
Definition: OMEbaseType.h:298
OMEoid::getInstanceInMemory
const class OMEobject * getInstanceInMemory() const
Return object information record.
Definition: OMEoid.h:280
OME_CRITICAL_SECTION_THREAD_QUEUE
@ OME_CRITICAL_SECTION_THREAD_QUEUE
Definition: OMEmutex.h:41
OMEthreadExecQueue::threadList
_STD deque< OMEthreadP > threadList[OME_MAX_PRIORITY_LEVELS]
Definition: OMEexecQueue.h:23
LOG_CERR
#define LOG_CERR(lvl)
Convenience macro that uses LOG_INTO() to conditionally log a message to standard error.
Definition: logging_api.hpp:3014
logging_api.hpp
FARGOS Logging API.
OMEqueueOIL2thread
void OMEqueueOIL2thread(OMEthread *t)
Definition: OMEexecQueue.cpp:586
Generated: Tue Jul 28 2020 16:03:25
Support Information