Skip to content

Commit 4d5f805

Browse files
committed
rtos: Tag non value type as NonCopyable.
The types marked are: Mail, MemoryPool, Mutex, Queue, RtosTimer and Semaphore.
1 parent 7a1e2cf commit 4d5f805

File tree

6 files changed

+14
-6
lines changed

6 files changed

+14
-6
lines changed

rtos/Mail.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "rtx_lib.h"
3232
#include "mbed_rtos1_types.h"
3333

34+
#include "platform/NonCopyable.h"
35+
3436
using namespace rtos;
3537

3638
namespace rtos {
@@ -47,7 +49,7 @@ namespace rtos {
4749
both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
4850
*/
4951
template<typename T, uint32_t queue_sz>
50-
class Mail {
52+
class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
5153
public:
5254
/** Create and Initialise Mail queue. */
5355
Mail() { };

rtos/MemoryPool.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "cmsis_os2.h"
2929
#include "mbed_rtos1_types.h"
3030
#include "mbed_rtos_storage.h"
31+
#include "platform/NonCopyable.h"
3132

3233
namespace rtos {
3334
/** \addtogroup rtos */
@@ -42,7 +43,7 @@ namespace rtos {
4243
both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
4344
*/
4445
template<typename T, uint32_t pool_sz>
45-
class MemoryPool {
46+
class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
4647
public:
4748
/** Create and Initialize a memory pool. */
4849
MemoryPool() {

rtos/Mutex.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "mbed_rtos1_types.h"
2828
#include "mbed_rtos_storage.h"
2929

30+
#include "platform/NonCopyable.h"
31+
3032
namespace rtos {
3133
/** \addtogroup rtos */
3234
/** @{*/
@@ -38,7 +40,7 @@ namespace rtos {
3840
Memory considerations: The mutex control structures will be created on current thread's stack, both for the mbed OS
3941
and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
4042
*/
41-
class Mutex {
43+
class Mutex : private mbed::NonCopyable<Mutex> {
4244
public:
4345
/** Create and Initialize a Mutex object */
4446
Mutex();

rtos/Queue.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "cmsis_os2.h"
2929
#include "mbed_rtos_storage.h"
3030
#include "platform/mbed_error.h"
31+
#include "platform/NonCopyable.h"
3132
#include "mbed_rtos1_types.h"
3233

3334
namespace rtos {
@@ -45,7 +46,7 @@ namespace rtos {
4546
and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
4647
*/
4748
template<typename T, uint32_t queue_sz>
48-
class Queue {
49+
class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
4950
public:
5051
/** Create and initialize a message Queue. */
5152
Queue() {

rtos/RtosTimer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "cmsis_os2.h"
2727
#include "rtx_lib.h"
2828
#include "platform/Callback.h"
29+
#include "platform/NonCopyable.h"
2930
#include "platform/mbed_toolchain.h"
3031
#include "mbed_rtos1_types.h"
3132

@@ -79,7 +80,7 @@ namespace rtos {
7980
Memory considerations: The timer control structures will be created on current thread's stack, both for the mbed OS
8081
and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
8182
*/
82-
class RtosTimer {
83+
class RtosTimer : private mbed::NonCopyable<RtosTimer> {
8384
public:
8485
/** Create timer.
8586
@param func function to be executed by this timer.

rtos/Semaphore.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "cmsis_os2.h"
2727
#include "mbed_rtos1_types.h"
2828
#include "mbed_rtos_storage.h"
29+
#include "platform/NonCopyable.h"
2930

3031
namespace rtos {
3132
/** \addtogroup rtos */
@@ -37,7 +38,7 @@ namespace rtos {
3738
* Memory considerations: The semaphore control structures will be created on current thread's stack, both for the mbed OS
3839
* and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
3940
*/
40-
class Semaphore {
41+
class Semaphore : private mbed::NonCopyable<Semaphore> {
4142
public:
4243
/** Create and Initialize a Semaphore object used for managing resources.
4344
@param count number of available resources; maximum index value is (count-1). (default: 0).

0 commit comments

Comments
 (0)