Skip to content

Commit

Permalink
review/various changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jakesmith committed Jun 26, 2024
1 parent 36c6811 commit 00087f9
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 107 deletions.
7 changes: 6 additions & 1 deletion system/jlib/jqueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@ class DListOf
}
};

// Lockfree Single Producer Single Conumser bounded queue implementation
// No mutexes are required to interact with the queue, as long as there's a single consumer thread, and a single writer thread.
template <typename T>
class CSPSCQueue
{
Expand All @@ -556,7 +558,10 @@ class CSPSCQueue

inline size32_t increment(size32_t idx) const
{
return (idx + 1) % maxCapacity;
size32_t next = idx+1;
if (next == maxCapacity)
next = 0;
return next;
}
public:
CSPSCQueue()
Expand Down
Loading

0 comments on commit 00087f9

Please sign in to comment.