FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
io_processor.hpp
Go to the documentation of this file.
1 #ifndef _IO_PROCESSOR_HPP_
2 #define _IO_PROCESSOR_HPP_ "$Id: io_processor.hpp 455 2020-07-23 20:23:59Z geoff $"
4 
6 /* Copyright (C) 2010 - 2019 FARGOS Development, LLC
7  * Author: Geoff Carpenter - http://www.fargos.net/gcc.html
8  */
9 
14 
37 #ifndef OS_SOCKET_TYPE
38 #ifdef _WIN32
39 #define OS_SOCKET_TYPE SOCKET
40 #else
41 #define OS_SOCKET_TYPE int
42 #endif
43 #endif /* OS_SOCKET_TYPE */
44 #ifndef OS_HANDLE_TYPE
45 #ifdef _WIN32
46 #define OS_HANDLE_TYPE HANDLE
47 #else
48 #define OS_HANDLE_TYPE int
49 #endif
50 #endif /* OS_HANDLE_TYPE */
51 #ifndef INVALID_SOCKET
52 #ifdef _WIN32
53 #define INVALID_SOCKET ((OS_SOCKET_TYPE)(~0))
54 #else
55 #define INVALID_SOCKET (-1)
56 #endif
57 #endif /* INVALID_SOCKET */
58 
59 
70  class IO_Processor *controller);
71 
80  class IO_Processor *controller);
81 
87 typedef int (*IO_consumeFP)(class IO_Processor *controller);
88 
94 typedef int (*IO_processFP)(class IO_Processor *controller);
95 
96 typedef int (*IO_blockAllocFP)(uint32_t blockLen,
97  class IO_Processor *controller);
98 
99 typedef int (*IO_blockFreeFP)(unsigned char *block,
100  class IO_Processor *controller);
101 
105  uint16_t headerLen;
106  uint16_t fromLen;
107  char _pad1[12];
109  uint64_t receiveTimeSeconds;
112  char fromAddress[32];
113 };
114 
115 
119 public:
121  // normally exposed as statistics variables
122  SMV_StandaloneNumeric<uint64_t> bytesRead; // updated by consume routine
123  SMV_StandaloneNumeric<uint64_t> bytesProcessed; // updated by processBlock routine
124  // normally exposed as statistics variables
125  SMV_StandaloneNumeric<uint32_t> packetsRead; // updated by consume routine
126 
127  SMV_StandaloneNumeric<uint32_t> packetsProcessed; // updated by process routine
129  SMV_StandaloneNumeric<uint32_t> maxReadTimeout; // adjustable, used by recvRoutine
132 
134  namingNode("io_stats", parentNode),
135  bytesRead("bytesRead", &namingNode),
136  bytesProcessed("bytesProcessed", &namingNode),
137  packetsRead("packetsRead", &namingNode),
138  packetsProcessed("packetsProcessed", &namingNode),
139  productiveReadSpins("productiveReadSpins", &namingNode),
140  maxReadTimeout("maxReadTimeout", &namingNode),
141  readAttemptsBeforeBlocking("readsBeforeBlock", &namingNode)
142  {
143  }
144 
146 };
147 
148 #pragma GCC diagnostic push
149 #pragma GCC diagnostic ignored "-Wsuggest-final-types"
150 
155 public:
157  enum ThreadMode {
158  NONE=0,
168  };
169 
171  enum BlockMode {
192  };
193 
202  void *extraData;
203 #ifdef _WIN32
204  HANDLE consumeThreadID;
205  HANDLE processThreadID;
206 #else
207  pthread_t consumeThreadID;
208  pthread_t processThreadID;
209 #endif
211  uint32_t descriptorFlags;
212  int32_t packetsProcessedIncrement; // signed
213  char label[24];
214  size_t maxPacketSize;
215  unsigned int lastReadTimeout;
216  unsigned char threadStartedState;
217  unsigned char currentThreadState;
218  unsigned char desiredThreadState;
219  unsigned char stopRequested;
220  unsigned char blockingMode;
221 
222 
223 
227  static ssize_t recvConsume(SharedBufferAllocRecord *rec,
228  class IO_Processor *controller);
229 
234  static int doConsumeLoop(IO_Processor *controller);
235 
241  static int doProcessLoop(IO_Processor *controller);
242 
250 
251 
254  BufferRegion *mgr, IO_processBlockFP b_func,
255  OS_HANDLE_TYPE h,
256 // COMMENT: maybe these should be flipped in order...
257  ThreadMode tMode=NONE, void *userData=nullptr, BlockMode bMode=PACKET,
260  IO_processFP p_func=doProcessLoop);
261 
262 #pragma GCC diagnostic push
263 #pragma GCC diagnostic ignored "-Wsuggest-final-methods"
264  virtual ~IO_Processor();
265 #pragma GCC diagnostic pop
266 
268  inline size_t dataOffset() const OME_ALWAYS_INLINE {
269  return ((blockingMode & _PACKET_HAS_META_DATA) ? sizeof(IO_metaBlock_header) : 0);
270  }
271 
275  inline unsigned char *bufferAddress(SharedBufferAllocRecord *rec,
276  size_t *bufferLen=nullptr) const OME_ALWAYS_INLINE {
277  const size_t data_off = dataOffset();
278  if (OME_EXPECT_TRUE(bufferLen != nullptr)) { // length is wanted...
279  // EOF will have usedLen == 0
280  *bufferLen = OME_EXPECT_TRUE((rec->usedLen >= data_off)) ? (rec->usedLen - data_off) : 0;
281  }
282  return (bfrManager->blockAddress(rec) + data_off);
283  }
284 
289  size_t *headerLen=nullptr) const OME_ALWAYS_INLINE {
290  if (headerLen != nullptr) {
291  *headerLen = dataOffset();
292  }
293  return (reinterpret_cast<IO_metaBlock_header *>(bfrManager->blockAddress(rec)));
294  }
295 
297  return (label);
298  }
299 
301  safe_strcpy(label, name, sizeof(label));
302  }
303 
304  void setPacketsProcessedIncrement(int32_t incVal) {
305  packetsProcessedIncrement = incVal;
306  }
307 
309  void setReadAttempts(uint32_t count) OME_ALWAYS_INLINE {
311  }
312 
315  return ((uint32_t) statistics->readAttemptsBeforeBlocking);
316  }
317 
319  void setReadTimeout(uint32_t count) OME_ALWAYS_INLINE {
320  statistics->maxReadTimeout = count;
321  }
322 
325  return ((uint32_t) statistics->maxReadTimeout);
326  }
327 
329  void setExtraData(void *data) OME_ALWAYS_INLINE {
330  extraData = data;
331  }
332 
335  return (extraData);
336  }
337 
339  void setMaxPacketSize(size_t bytes) OME_ALWAYS_INLINE {
340  maxPacketSize = bytes;
341  }
342 
345  processBlockRoutine = func;
346  }
347 
350  processRoutine = func;
351  }
352 
355  consumeRoutine = func;
356  }
357 
360  recvRoutine = func;
361  }
362 
364  uint32_t getThreadMode() const OME_ALWAYS_INLINE {
365  return (desiredThreadState);
366  }
367 
369  int setThreadMode(ThreadMode mode);
370 
372  void setBlockingMode(BlockMode mode);
373 
375  int stopThread(uint32_t modes);
376 
378  int interruptThread(uint32_t modes, bool force=false);
379 
381  int waitForThreadStart(uint32_t mode);
382 
384  int waitForThreadExit(uint32_t modes);
385 
387  int waitForDataToProcess(bool alreadyLocked=false);
388 
390  int waitForDataToProcessOrUntil(const struct timespec *maxWaitUntil, bool alreadyLocked=false);
391 
393  int noteDataToProcess(bool alreadyLocked=false);
394 
395 
396 }; // end class IO_Processor
397 
398 #pragma GCC diagnostic pop
399 
400 #ifndef _WIN32
401 void setLabelForThread(pthread_t threadId, const char *label);
402 #else
403 void setLabelForThread(HANDLE threadId, const char *label);
404 #endif
405 
406 /* NOTE: these templated routines are marked as inline to allow
407  * duplicate definitions to be collapsed at link time; as a practical
408  * matter, they require an actual function body to be generated.
409  */
410 
414 template <class PARSER_TYPE> inline int processPacketUsingClass(SharedBufferAllocRecord *rec, class IO_Processor *controller)
415 {
416  size_t len;
417 
418  unsigned char *bfr = controller->bufferAddress(rec, &len);
419  PARSER_TYPE *parser = (PARSER_TYPE *) (controller->getExtraData());
420  int rc = parser->processPacket(bfr, len);
421  if (OME_EXPECT_FALSE(rc == -2)) {
422  rec->usedLen = 0; // force inject EOF
423  return (0);
424  }
425  return (rc);
426 }
427 
432 template <class PARSER_TYPE> inline int processPacketFromSourceUsingClass(SharedBufferAllocRecord *rec, class IO_Processor *controller)
433 {
434  size_t len, hdrLen;
435  IO_metaBlock_header *metaHdr;
436 
438  metaHdr = controller->bufferHeaderAddress(rec, &hdrLen);
439  } else {
440  metaHdr = nullptr;
441  hdrLen = 0;
442  }
443  unsigned char *bfr = controller->bufferAddress(rec, &len);
444  PARSER_TYPE *parser = (PARSER_TYPE *) (controller->getExtraData());
445  int rc = parser->processPacketFromSource(bfr, len, metaHdr, hdrLen);
446  if (OME_EXPECT_FALSE(rc == -2)) {
447  rec->usedLen = 0; // force inject EOF
448  return (0);
449  }
450  return (rc);
451 }
452 
454 #endif
455 /* vim: set expandtab shiftwidth=4 tabstop=4: */
IO_Processor::PROCESS_THREAD
@ PROCESS_THREAD
Definition: io_processor.hpp:160
safe_strcpy
#define safe_strcpy(d, s, l)
Safe strcpy() routine that will not copy more than l bytes and always ensures that a null is present ...
Definition: compiler_hints.h:696
IO_Processor::processRoutine
IO_processFP processRoutine
Definition: io_processor.hpp:198
IO_Processor_Statistics::packetsProcessed
SMV_StandaloneNumeric< uint32_t > packetsProcessed
Definition: io_processor.hpp:127
IO_metaBlock_header::receiveTimeNanoseconds
uint64_t receiveTimeNanoseconds
receive time fractional nanoseconds
Definition: io_processor.hpp:111
SharedMemoryVariable::getName
const char * getName(uint_fast32_t *retNameLen=nullptr) const OME_ALWAYS_INLINE
Get variable name.
Definition: shared_variable.hpp:135
IO_Processor::statistics
IO_Processor_Statistics * statistics
statistics
Definition: io_processor.hpp:195
IO_Processor::_PACKET_HAS_SOURCE
@ _PACKET_HAS_SOURCE
bit flag indicating source information
Definition: io_processor.hpp:175
IO_Processor
Intermediary I/O processing object for performing multi-threaded receive-and-process operations on a ...
Definition: io_processor.hpp:154
get_time.h
Time acquisition routines.
IO_Processor::IO_Processor
IO_Processor(SharedMemoryVariableNode *parentNode, BufferRegion *mgr, IO_processBlockFP b_func, OS_HANDLE_TYPE h, ThreadMode tMode=NONE, void *userData=nullptr, BlockMode bMode=PACKET, IO_receiveBlockFP r_func=recvConsume, IO_consumeFP c_func=doConsumeLoop, IO_processFP p_func=doProcessLoop)
Constructor for IO_Processor.
Definition: io_processor.cpp:486
IO_Processor::currentThreadState
unsigned char currentThreadState
Definition: io_processor.hpp:217
IO_Processor::getReadTimeout
uint32_t getReadTimeout() const OME_ALWAYS_INLINE
Get limit on read attempts before blocking.
Definition: io_processor.hpp:324
OS_SOCKET_TYPE
#define OS_SOCKET_TYPE
Definition: io_processor.hpp:41
io_processor.hpp
FARGOS I/O Processing classes.
SharedBufferAllocRecord_32
Allocation record for chains in a 32-bit shared memory buffer.
Definition: circular_bfr.hpp:103
IO_Processor::getLabel
const char * getLabel() const OME_ALWAYS_INLINE NONNULL_RETURN
Definition: io_processor.hpp:296
IO_Processor::getExtraData
void * getExtraData() const OME_ALWAYS_INLINE
Retrieve extra information value.
Definition: io_processor.hpp:334
BufferRegion::blockAddress
virtual unsigned char * blockAddress(const SharedBufferAllocRecord *record)
Definition: circular_bfr.hpp:282
TimedMutex::unlock
int64_t unlock()
Release a previously locked mutex.
Definition: timed_mutex.cpp:156
IO_metaBlock_header::receiveTimeSeconds
uint64_t receiveTimeSeconds
receive time in seconds
Definition: io_processor.hpp:110
BufferRegion::getActiveListHead
virtual SharedBufferAllocRecord * getActiveListHead()
Return first active allocation record.
Definition: circular_bfr.cpp:196
IO_Processor::consumeRoutine
IO_consumeFP consumeRoutine
Definition: io_processor.hpp:200
IO_Processor::~IO_Processor
virtual ~IO_Processor()
Definition: io_processor.cpp:548
IO_Processor::lastReadTimeout
unsigned int lastReadTimeout
Definition: io_processor.hpp:215
IO_Processor::dataOffset
size_t dataOffset() const OME_ALWAYS_INLINE
Return number of bytes reserved for meta data on each data element.
Definition: io_processor.hpp:268
IO_blockAllocFP
int(* IO_blockAllocFP)(uint32_t blockLen, class IO_Processor *controller)
Definition: io_processor.hpp:96
SMV_StandaloneNumeric< uint64_t >
SharedMemoryVariable::getParentNode
SharedMemoryVariableNode * getParentNode() const
Definition: shared_variable.hpp:113
IO_Processor::extraData
void * extraData
arbitrary extra data
Definition: io_processor.hpp:202
IO_Processor_Statistics::namingNode
SharedMemoryVariableNode namingNode
Definition: io_processor.hpp:120
IO_metaBlock_header
Structure to hold meta-data related to a block of received data.
Definition: io_processor.hpp:104
IO_receiveBlockFP
ssize_t(* IO_receiveBlockFP)(SharedBufferAllocRecord *rec, class IO_Processor *controller)
The receiveBlock routine should retrieve data and store it into the indicated block of memory,...
Definition: io_processor.hpp:79
IO_Processor::bufferAddress
unsigned char * bufferAddress(SharedBufferAllocRecord *rec, size_t *bufferLen=nullptr) const OME_ALWAYS_INLINE
Return physical address of a buffer within the context of the local process' address space.
Definition: io_processor.hpp:275
EAGAIN
#define EAGAIN
Definition: tmp.o.cpp:64
getCurrentTime
const struct TimeWithNanoseconds * getCurrentTime(struct TimeWithNanoseconds *saveTo, bool forceUpdate)
Get the current time.
Definition: get_time.cpp:20
IO_Processor::_NOT_SOCKET
@ _NOT_SOCKET
force use of read vs. recv().
Definition: io_processor.hpp:181
IO_Processor_Statistics::~IO_Processor_Statistics
~IO_Processor_Statistics()
Definition: io_processor.hpp:145
IO_Processor::SEPARATE_READ_AND_PROCESS_THREADS
@ SEPARATE_READ_AND_PROCESS_THREADS
Definition: io_processor.hpp:165
IO_Processor::setLabel
void setLabel(const char *name) OME_ALWAYS_INLINE NONNULL_CLASS_PARAMETERS(2)
Definition: io_processor.hpp:300
IO_Processor_Statistics::bytesProcessed
SMV_StandaloneNumeric< uint64_t > bytesProcessed
Definition: io_processor.hpp:123
IO_Processor_Statistics
Holds collected statistics for an IO_Processor object.
Definition: io_processor.hpp:118
SharedMemoryVariableNode
Intermediate naming node for supporting variable naming hierarchies.
Definition: shared_variable.hpp:318
IO_Processor_Statistics::bytesRead
SMV_StandaloneNumeric< uint64_t > bytesRead
Definition: io_processor.hpp:122
OME_YIELD_THREAD
#define OME_YIELD_THREAD()
Macro for platform-specific yield of thread's time slice.
Definition: compiler_hints.h:547
INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE
Definition: poll_monitor.hpp:19
IO_Processor::getThreadMode
uint32_t getThreadMode() const OME_ALWAYS_INLINE
Get requested thread modes.
Definition: io_processor.hpp:364
IO_Processor::processThreadID
pthread_t processThreadID
Definition: io_processor.hpp:208
SIGIO
#define SIGIO
Definition: tmp.o.cpp:526
NONNULL_CLASS_PARAMETERS
#define NONNULL_CLASS_PARAMETERS(...)
Mark a function as never returning a null pointer.
Definition: compiler_hints.h:337
IO_Processor::threadStartedState
unsigned char threadStartedState
Definition: io_processor.hpp:216
TimeWithNanoseconds
Structure for representing time as relative seconds and nanoseconds.
Definition: get_time.h:24
IO_Processor::recvRoutine
IO_receiveBlockFP recvRoutine
Definition: io_processor.hpp:201
TimedCondition::postCondition
int postCondition()
Notify any sleeping threads that the condition has occurred.
Definition: timed_mutex.cpp:358
IO_processFP
int(* IO_processFP)(class IO_Processor *controller)
Long running routine which processes all input made available by the corresponding consume routine.
Definition: io_processor.hpp:94
IO_Processor::ThreadMode
ThreadMode
Mask to select threading modes.
Definition: io_processor.hpp:157
IO_Processor::setConsumeRoutine
void setConsumeRoutine(IO_receiveBlockFP func) OME_ALWAYS_INLINE
Set consume routine.
Definition: io_processor.hpp:359
IO_metaBlock_header::fromAddress
char fromAddress[32]
sockaddr_t of source
Definition: io_processor.hpp:112
IO_Processor::waitForDataToProcess
int waitForDataToProcess(bool alreadyLocked=false)
Wait for data to arrive.
Definition: io_processor.cpp:755
processPacketFromSourceUsingClass
int processPacketFromSourceUsingClass(SharedBufferAllocRecord *rec, class IO_Processor *controller)
Implements a processing routine that invokes a processPacketFromSource() routine upon each incoming p...
Definition: io_processor.hpp:432
IO_Processor::setReadAttempts
void setReadAttempts(uint32_t count) OME_ALWAYS_INLINE
Set read attempts before blocking.
Definition: io_processor.hpp:309
IO_Processor_Statistics::readAttemptsBeforeBlocking
SMV_StandaloneNumeric< uint32_t > readAttemptsBeforeBlocking
max unproductive read attempts before thread blocks
Definition: io_processor.hpp:131
IO_Processor_Statistics::IO_Processor_Statistics
IO_Processor_Statistics(SharedMemoryVariableNode *parentNode)
Definition: io_processor.hpp:133
IO_Processor::setThreadMode
int setThreadMode(ThreadMode mode)
Set threading mode.
Definition: io_processor.cpp:564
SOCKET_CAST
#define SOCKET_CAST(x)
Definition: io_processor.cpp:47
IO_Processor::BlockMode
BlockMode
Blocking mode.
Definition: io_processor.hpp:171
TimeWithNanoseconds::time_nanosec
uint64_t time_nanosec
Definition: get_time.h:26
srcID
const char srcID[]
Definition: catSym.c:17
timed_mutex.hpp
waitForBufferAllocRecordToBeReady
void waitForBufferAllocRecordToBeReady(SharedBufferAllocRecord *rec)
Verify record is prepared and, if needed, wait until it is prepared.
Definition: circular_wait.hpp:16
IO_Processor::setMaxPacketSize
void setMaxPacketSize(size_t bytes) OME_ALWAYS_INLINE
Set MTU.
Definition: io_processor.hpp:339
IO_metaBlock_header::headerLen
uint16_t headerLen
length of the header
Definition: io_processor.hpp:105
IO_Processor::READ_AND_PROCESS_ON_SAME_THREAD
@ READ_AND_PROCESS_ON_SAME_THREAD
a single spawned read thread will do both read-and-processing
Definition: io_processor.hpp:167
IO_Processor::descriptor
OS_HANDLE_TYPE descriptor
Definition: io_processor.hpp:210
circular_bfr.hpp
IO_Processor::waitForDataToProcessOrUntil
int waitForDataToProcessOrUntil(const struct timespec *maxWaitUntil, bool alreadyLocked=false)
Wait for data to arrive or until a point in time.
Definition: io_processor.cpp:775
IO_Processor::CONTIGUOUS_FILE_STREAM
@ CONTIGUOUS_FILE_STREAM
contiguous byte stream from file
Definition: io_processor.hpp:185
IO_Processor::packetsProcessedIncrement
int32_t packetsProcessedIncrement
Definition: io_processor.hpp:212
IO_Processor::doConsumeLoop
static int doConsumeLoop(IO_Processor *controller)
Standard consume loop to receive incoming data.
Definition: io_processor.cpp:172
OME_EXPECT_TRUE
#define OME_EXPECT_TRUE(expr)
Annotation macro for conditional expression expected to be true.
Definition: compiler_hints.h:541
processPacketUsingClass
int processPacketUsingClass(SharedBufferAllocRecord *rec, class IO_Processor *controller)
Implements a processing routine that invokes a processPacket() routine upon each incoming packet.
Definition: io_processor.hpp:414
IO_Processor::waitForThreadExit
int waitForThreadExit(uint32_t modes)
Wait for threads to terminate.
Definition: io_processor.cpp:728
IO_Processor_Statistics::packetsRead
SMV_StandaloneNumeric< uint32_t > packetsRead
Definition: io_processor.hpp:125
BufferRegion::allocateBlock
virtual SharedBufferAllocRecord * allocateBlock(size_t len)=0
IO_Processor::stopThread
int stopThread(uint32_t modes)
Request stop.
Definition: io_processor.cpp:684
IO_Processor::setPacketsProcessedIncrement
void setPacketsProcessedIncrement(int32_t incVal)
Definition: io_processor.hpp:304
BufferRegion::returnBlock
virtual void returnBlock(SharedBufferAllocRecord *record)=0
IO_Processor::setExtraData
void setExtraData(void *data) OME_ALWAYS_INLINE
Set extra information value.
Definition: io_processor.hpp:329
IO_Processor::PROCESS_DURING_READ
@ PROCESS_DURING_READ
Processing will be performed by the read thread.
Definition: io_processor.hpp:162
TimedMutex
Generic mutex implementation that supports timing statistics.
Definition: timed_mutex.hpp:51
IO_Processor::condition
TimedCondition * condition
Definition: io_processor.hpp:197
IO_Processor::setBlockingMode
void setBlockingMode(BlockMode mode)
Set block delivery mode.
Definition: io_processor.cpp:641
BufferRegion::getBlockSize
size_t getBlockSize() const OME_ALWAYS_INLINE
Return the block size set for the region.
Definition: circular_bfr.hpp:248
PTHREAD_CREATE_JOINABLE
#define PTHREAD_CREATE_JOINABLE
Definition: tmp.o.cpp:425
TimedCondition::isSleeping
bool isSleeping() const OME_ALWAYS_INLINE
Return a Boolean indication of whether or not a thread is sleeping.
Definition: timed_mutex.hpp:338
NULL
#define NULL
Definition: tmp.o.cpp:327
IO_Processor::submitOrProcessBlock
int submitOrProcessBlock(SharedBufferAllocRecord *rec)
Submission routine that will either directly invoke the processing routine or notify the processing t...
Definition: io_processor.cpp:144
IO_Processor::maxPacketSize
size_t maxPacketSize
max to receive in one go
Definition: io_processor.hpp:214
htons
#define htons(x)
Definition: tmp.o.cpp:3100
TimedCondition
Generic condition variable for use with the TimedMutex class.
Definition: timed_mutex.hpp:216
IO_Processor::_PACKET_HAS_RECEIVE_TIME
@ _PACKET_HAS_RECEIVE_TIME
bit flag indicating arrival time
Definition: io_processor.hpp:177
IO_Processor::NONE
@ NONE
No threads will be spawned.
Definition: io_processor.hpp:158
shared_variable.hpp
FARGOS Shared Memory Variable routines.
OME_USED
const char srcID[] OME_USED
Definition: tick_time.cpp:24
IO_Processor::PACKET_WITH_SOURCE
@ PACKET_WITH_SOURCE
packet message unit including source address
Definition: io_processor.hpp:187
IO_Processor::PACKET
@ PACKET
packet message unit, like a datagram
Definition: io_processor.hpp:173
IO_Processor::READ_THREAD
@ READ_THREAD
A read thread will be spawned.
Definition: io_processor.hpp:159
IO_Processor::interruptThread
int interruptThread(uint32_t modes, bool force=false)
Interrupt blocked thread.
Definition: io_processor.cpp:646
IO_Processor::mutex
TimedMutex * mutex
Definition: io_processor.hpp:196
TimeWithNanoseconds::time_sec
uint64_t time_sec
Definition: get_time.h:25
IO_metaBlock_header::fromLen
uint16_t fromLen
Definition: io_processor.hpp:106
IO_Processor::PACKET_WITH_TIME
@ PACKET_WITH_TIME
packet message with arrival time
Definition: io_processor.hpp:189
atomic_values.h
Atomic operations.
IO_Processor::_PACKET_HAS_META_DATA
@ _PACKET_HAS_META_DATA
bit flags indicating meta data present
Definition: io_processor.hpp:179
IO_Processor_Statistics::productiveReadSpins
SMV_StandaloneNumeric< uint32_t > productiveReadSpins
Definition: io_processor.hpp:128
errno
int errno
Definition: ethers.c:41
compiler_hints.h
Compiler-specific macros to provide performance-related hints.
OME_EXPECT_FALSE
#define OME_EXPECT_FALSE(expr)
Annotation macro for conditional expression expected to be false.
Definition: compiler_hints.h:540
SharedBufferAllocRecord_32::usedLen
uint32_t usedLen
Definition: circular_bfr.hpp:107
OME_ALWAYS_INLINE
#define OME_ALWAYS_INLINE
Tell the compiler to alway inline a function, regardless of optimization level.
Definition: compiler_hints.h:364
IO_Processor::PACKET_WITH_SOURCE_AND_TIME
@ PACKET_WITH_SOURCE_AND_TIME
packet message with source address and arrival time
Definition: io_processor.hpp:191
IO_Processor::setProcessLoopRoutine
void setProcessLoopRoutine(IO_processFP func) OME_ALWAYS_INLINE
Set processing loop routine.
Definition: io_processor.hpp:349
IO_consumeFP
int(* IO_consumeFP)(class IO_Processor *controller)
Long running routine which receives all input from input source.
Definition: io_processor.hpp:87
IO_Processor::waitForThreadStart
int waitForThreadStart(uint32_t mode)
Wait for threads to start.
Definition: io_processor.cpp:712
IO_Processor::descriptorFlags
uint32_t descriptorFlags
Definition: io_processor.hpp:211
IO_Processor::processBlockRoutine
IO_processBlockFP processBlockRoutine
Definition: io_processor.hpp:199
IO_Processor::noteDataToProcess
int noteDataToProcess(bool alreadyLocked=false)
Note new data has arrived.
Definition: io_processor.cpp:803
IO_Processor::blockingMode
unsigned char blockingMode
Definition: io_processor.hpp:220
IO_Processor::setConsumeLoopRoutine
void setConsumeLoopRoutine(IO_consumeFP func) OME_ALWAYS_INLINE
Set consume loop routine.
Definition: io_processor.hpp:354
IO_Processor::bfrManager
BufferRegion * bfrManager
buffer region
Definition: io_processor.hpp:194
IO_Processor::CONTIGUOUS_BYTE_STREAM
@ CONTIGUOUS_BYTE_STREAM
contiguous byte stream from socket
Definition: io_processor.hpp:183
IO_Processor::desiredThreadState
unsigned char desiredThreadState
Definition: io_processor.hpp:218
IO_Processor::setProcessRoutine
void setProcessRoutine(IO_processBlockFP func) OME_ALWAYS_INLINE
Set processing routine.
Definition: io_processor.hpp:344
OS_HANDLE_TYPE
#define OS_HANDLE_TYPE
Definition: io_processor.hpp:48
IO_Processor::consumeThreadID
pthread_t consumeThreadID
Definition: io_processor.hpp:207
BufferRegion
Interface to a buffer region. This is an abstract class.
Definition: circular_bfr.hpp:177
IO_Processor::getReadAttempts
uint32_t getReadAttempts() const OME_ALWAYS_INLINE
Get limit on read attempts before blocking.
Definition: io_processor.hpp:314
IO_Processor::label
char label[24]
Definition: io_processor.hpp:213
IO_Processor::setReadTimeout
void setReadTimeout(uint32_t count) OME_ALWAYS_INLINE
Set read timeout.
Definition: io_processor.hpp:319
IO_Processor::doProcessLoop
static int doProcessLoop(IO_Processor *controller)
Standard processing loop to process data on separate thread; works in conjunction with doConsumeLoop(...
Definition: io_processor.cpp:219
IO_Processor::bufferHeaderAddress
IO_metaBlock_header * bufferHeaderAddress(SharedBufferAllocRecord *rec, size_t *headerLen=nullptr) const OME_ALWAYS_INLINE
Return physical address of meta block header within the context of the local process' address space.
Definition: io_processor.hpp:288
IO_Processor::BOTH_THREADS
@ BOTH_THREADS
Both a read and a processing thread will be spawned.
Definition: io_processor.hpp:164
setLabelForThread
void setLabelForThread(pthread_t threadId, const char *label)
Definition: io_processor.cpp:51
IO_Processor::stopRequested
unsigned char stopRequested
Definition: io_processor.hpp:219
SA_SIGINFO
#define SA_SIGINFO
Definition: tmp.o.cpp:494
IO_blockFreeFP
int(* IO_blockFreeFP)(unsigned char *block, class IO_Processor *controller)
Definition: io_processor.hpp:99
NONNULL_RETURN
char NONNULL_RETURN
Definition: compiler_hints.h:745
IO_Processor_Statistics::maxReadTimeout
SMV_StandaloneNumeric< uint32_t > maxReadTimeout
Definition: io_processor.hpp:129
IO_Processor::recvConsume
static ssize_t recvConsume(SharedBufferAllocRecord *rec, class IO_Processor *controller)
Definition: io_processor.cpp:279
IO_processBlockFP
int(* IO_processBlockFP)(SharedBufferAllocRecord *rec, class IO_Processor *controller)
Process a block of data received from an input source.
Definition: io_processor.hpp:69
EINTR
#define EINTR
Definition: tmp.o.cpp:93
Generated: Fri Jul 31 2020 18:19:14
Support Information