rtos: Tag non value type as NonCopyable.

The types marked are: Mail, MemoryPool, Mutex, Queue, RtosTimer and Semaphore.
pull/4594/head
Vincent Coubard 2017-06-20 13:00:20 +01:00
parent 7a1e2cfc9a
commit 4d5f805cde
6 changed files with 14 additions and 6 deletions

View File

@ -31,6 +31,8 @@
#include "rtx_lib.h" #include "rtx_lib.h"
#include "mbed_rtos1_types.h" #include "mbed_rtos1_types.h"
#include "platform/NonCopyable.h"
using namespace rtos; using namespace rtos;
namespace rtos { namespace rtos {
@ -47,7 +49,7 @@ namespace rtos {
both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used). both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
*/ */
template<typename T, uint32_t queue_sz> template<typename T, uint32_t queue_sz>
class Mail { class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
public: public:
/** Create and Initialise Mail queue. */ /** Create and Initialise Mail queue. */
Mail() { }; Mail() { };

View File

@ -28,6 +28,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "mbed_rtos1_types.h" #include "mbed_rtos1_types.h"
#include "mbed_rtos_storage.h" #include "mbed_rtos_storage.h"
#include "platform/NonCopyable.h"
namespace rtos { namespace rtos {
/** \addtogroup rtos */ /** \addtogroup rtos */
@ -42,7 +43,7 @@ namespace rtos {
both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used). both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
*/ */
template<typename T, uint32_t pool_sz> template<typename T, uint32_t pool_sz>
class MemoryPool { class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
public: public:
/** Create and Initialize a memory pool. */ /** Create and Initialize a memory pool. */
MemoryPool() { MemoryPool() {

View File

@ -27,6 +27,8 @@
#include "mbed_rtos1_types.h" #include "mbed_rtos1_types.h"
#include "mbed_rtos_storage.h" #include "mbed_rtos_storage.h"
#include "platform/NonCopyable.h"
namespace rtos { namespace rtos {
/** \addtogroup rtos */ /** \addtogroup rtos */
/** @{*/ /** @{*/
@ -38,7 +40,7 @@ namespace rtos {
Memory considerations: The mutex control structures will be created on current thread's stack, both for the mbed OS Memory considerations: The mutex control structures will be created on current thread's stack, both for the mbed OS
and underlying RTOS objects (static or dynamic RTOS memory pools are not being used). and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
*/ */
class Mutex { class Mutex : private mbed::NonCopyable<Mutex> {
public: public:
/** Create and Initialize a Mutex object */ /** Create and Initialize a Mutex object */
Mutex(); Mutex();

View File

@ -28,6 +28,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "mbed_rtos_storage.h" #include "mbed_rtos_storage.h"
#include "platform/mbed_error.h" #include "platform/mbed_error.h"
#include "platform/NonCopyable.h"
#include "mbed_rtos1_types.h" #include "mbed_rtos1_types.h"
namespace rtos { namespace rtos {
@ -45,7 +46,7 @@ namespace rtos {
and underlying RTOS objects (static or dynamic RTOS memory pools are not being used). and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
*/ */
template<typename T, uint32_t queue_sz> template<typename T, uint32_t queue_sz>
class Queue { class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
public: public:
/** Create and initialize a message Queue. */ /** Create and initialize a message Queue. */
Queue() { Queue() {

View File

@ -26,6 +26,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "rtx_lib.h" #include "rtx_lib.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "platform/NonCopyable.h"
#include "platform/mbed_toolchain.h" #include "platform/mbed_toolchain.h"
#include "mbed_rtos1_types.h" #include "mbed_rtos1_types.h"
@ -79,7 +80,7 @@ namespace rtos {
Memory considerations: The timer control structures will be created on current thread's stack, both for the mbed OS Memory considerations: The timer control structures will be created on current thread's stack, both for the mbed OS
and underlying RTOS objects (static or dynamic RTOS memory pools are not being used). and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
*/ */
class RtosTimer { class RtosTimer : private mbed::NonCopyable<RtosTimer> {
public: public:
/** Create timer. /** Create timer.
@param func function to be executed by this timer. @param func function to be executed by this timer.

View File

@ -26,6 +26,7 @@
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "mbed_rtos1_types.h" #include "mbed_rtos1_types.h"
#include "mbed_rtos_storage.h" #include "mbed_rtos_storage.h"
#include "platform/NonCopyable.h"
namespace rtos { namespace rtos {
/** \addtogroup rtos */ /** \addtogroup rtos */
@ -37,7 +38,7 @@ namespace rtos {
* Memory considerations: The semaphore control structures will be created on current thread's stack, both for the mbed OS * Memory considerations: The semaphore control structures will be created on current thread's stack, both for the mbed OS
* and underlying RTOS objects (static or dynamic RTOS memory pools are not being used). * and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
*/ */
class Semaphore { class Semaphore : private mbed::NonCopyable<Semaphore> {
public: public:
/** Create and Initialize a Semaphore object used for managing resources. /** Create and Initialize a Semaphore object used for managing resources.
@param count number of available resources; maximum index value is (count-1). (default: 0). @param count number of available resources; maximum index value is (count-1). (default: 0).