FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
circular_wait.hpp
Go to the documentation of this file.
1 #ifndef _CIRCULAR_WAIT_HPP_
2 #define _CIRCULAR_WAIT_HPP_ "$Id: circular_wait.hpp 316 2020-03-26 16:18:40Z geoff $"
4 
10 /* Implementation of waitForBufferAllocRecord()
11  * so that it can be inlined on non-Windows hosts
12  * or deferred so as to avoid the need for windows.h
13  * and seeing it prior to winsock2.h
14  */
15 
17 {
18  if (OME_EXPECT_FALSE(rec->usedLen == ~0U)) {
19  uint_fast32_t spinCount = 0;
20  do {
21  spinCount += 1;
22  if ((spinCount & 0x7) == 0) {
23 #ifndef _WIN32
24  struct timespec now;
25  now.tv_sec = 0;
26  now.tv_nsec = 500000; // delay 500 microseconds
27  nanosleep(&now, nullptr);
28 #else
29  SleepEx(1, FALSE); // delay 1 millisecond
30 #endif
31  } else {
33  }
34  } while (rec->usedLen == ~0U);
35  }
36 }
37 
39 #endif
40 /* vim: set expandtab shiftwidth=4 tabstop=4: */
SharedBufferAllocRecord_32
Allocation record for chains in a 32-bit shared memory buffer.
Definition: circular_bfr.hpp:103
OME_YIELD_THREAD
#define OME_YIELD_THREAD()
Macro for platform-specific yield of thread's time slice.
Definition: compiler_hints.h:547
waitForBufferAllocRecordToBeReady
void waitForBufferAllocRecordToBeReady(SharedBufferAllocRecord *rec)
Verify record is prepared and, if needed, wait until it is prepared.
Definition: circular_wait.hpp:16
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
Generated: Fri Jul 31 2020 18:19:13
Support Information