Friendly LWM2M client
SafeQueue.h File Reference
#include <string.h>
#include <vector>
#include <WppGuard.h>
+ Include dependency graph for SafeQueue.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SafeQueue< T, SIZE >
 SafeQueue is an implementation of the thread/IRQ safe queue that does not use dynamic memory, and can perform sumultaneously pop() and push() without any blocking, that alows use this implementation as data container in the critical sections, or threads and IRQ where it is impossible to wait for access to the container and data loss is unacceptable. Developed with a focus on embedded systems. More...
 

Macros

#define SQ_GUARD_CREATE(name)   wpp::WppGuard name
 Include with the guard implementation for protecting the critical section of code. More...
 
#define SQ_GUARD_LOCK(name)   name.lock()
 Macro for locking the specified guard object. The lock() method is used to acquire the lock on the guard object, preventing other threads from accessing the critical section of code. The name parameter should be the name of a guard object. More...
 
#define SQ_GUARD_UNLOCK(name)   name.unlock()
 Macro for unlocking the specified guard object. The unlock() method is used to release the lock on the guard object, allowing other threads to access the critical section of code. The name parameter should be the name of a guard object. More...
 
#define SQ_GUARD_TRY_LOCK(name)   name.try_lock()
 Macro for trying to lock the specified guard object. The try_lock() method is used to attempt to acquire the lock on the guard object. If the lock is successfully acquired, the method returns true. Otherwise, it returns false. The name parameter should be the name of a guard object. More...
 
#define SAFE_QUEUE_DEF_ELEM_CNT   0x01
 

Detailed Description

Version
1.0.1 https://github.com/VSkoshchuk/SafeQueue

Copyright (c) 2023 VSkoshchuk skosc.nosp@m.huk9.nosp@m.99@gm.nosp@m.ail..nosp@m.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition in file SafeQueue.h.

Macro Definition Documentation

◆ SAFE_QUEUE_DEF_ELEM_CNT

#define SAFE_QUEUE_DEF_ELEM_CNT   0x01

Definition at line 75 of file SafeQueue.h.

◆ SQ_GUARD_CREATE

#define SQ_GUARD_CREATE (   name)    wpp::WppGuard name

Include with the guard implementation for protecting the critical section of code.

Note
Can be changed to any other implementation.

Macro for creating a guard object with the specified name. The guard object is used to protect critical sections of code from simultaneous access by multiple threads. The name parameter should be a valid identifier.

Note
Can be changed to any other implementation.

Definition at line 47 of file SafeQueue.h.

◆ SQ_GUARD_LOCK

#define SQ_GUARD_LOCK (   name)    name.lock()

Macro for locking the specified guard object. The lock() method is used to acquire the lock on the guard object, preventing other threads from accessing the critical section of code. The name parameter should be the name of a guard object.

Note
Can be changed to any other implementation.

Definition at line 55 of file SafeQueue.h.

◆ SQ_GUARD_TRY_LOCK

#define SQ_GUARD_TRY_LOCK (   name)    name.try_lock()

Macro for trying to lock the specified guard object. The try_lock() method is used to attempt to acquire the lock on the guard object. If the lock is successfully acquired, the method returns true. Otherwise, it returns false. The name parameter should be the name of a guard object.

Note
Can be changed to any other implementation.

Definition at line 72 of file SafeQueue.h.

◆ SQ_GUARD_UNLOCK

#define SQ_GUARD_UNLOCK (   name)    name.unlock()

Macro for unlocking the specified guard object. The unlock() method is used to release the lock on the guard object, allowing other threads to access the critical section of code. The name parameter should be the name of a guard object.

Note
Can be changed to any other implementation.

Definition at line 63 of file SafeQueue.h.