Make rxQueue lock-free using an atomic counter ring buffer.
This commit is contained in:
parent
7e6598e9ca
commit
e3cf756785
3 changed files with 33 additions and 39 deletions
|
@ -47,6 +47,15 @@ public:
|
|||
_v = 0;
|
||||
}
|
||||
|
||||
inline int load() const
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
return __sync_or_and_fetch(&_v,0);
|
||||
#else
|
||||
return _v.load();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int operator++()
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue