未验证 提交 2f1ab871 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #2808 from tyustli/cpp_thread

fix cpp thread class error
...@@ -14,7 +14,7 @@ Thread::Thread(rt_uint32_t stack_size, ...@@ -14,7 +14,7 @@ Thread::Thread(rt_uint32_t stack_size,
rt_uint8_t priority, rt_uint8_t priority,
rt_uint32_t tick, rt_uint32_t tick,
const char *name) const char *name)
: _entry(RT_NULL), _param(RT_NULL), started(false) : _entry(RT_NULL), _param(RT_NULL), started(false)
{ {
rt_event_init(&_event, name, 0); rt_event_init(&_event, name, 0);
...@@ -32,7 +32,7 @@ Thread::Thread(void (*entry)(void *p), ...@@ -32,7 +32,7 @@ Thread::Thread(void (*entry)(void *p),
rt_uint8_t priority, rt_uint8_t priority,
rt_uint32_t tick, rt_uint32_t tick,
const char *name) const char *name)
: _entry(RT_NULL), _param(p), started(false) : _entry(entry), _param(p), started(false)
{ {
rt_event_init(&_event, name, 0); rt_event_init(&_event, name, 0);
...@@ -46,6 +46,7 @@ Thread::Thread(void (*entry)(void *p), ...@@ -46,6 +46,7 @@ Thread::Thread(void (*entry)(void *p),
Thread::~Thread() Thread::~Thread()
{ {
rt_event_detach(&_event);
rt_thread_delete(_thread); rt_thread_delete(_thread);
} }
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
#include "utest_log.h" #include "utest_log.h"
#include "utest_assert.h" #include "utest_assert.h"
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* utest_error * utest_error
* *
...@@ -157,4 +161,8 @@ utest_t utest_handle_get(void); ...@@ -157,4 +161,8 @@ utest_t utest_handle_get(void);
utest_unit_run(test_unit_func, #test_unit_func); \ utest_unit_run(test_unit_func, #test_unit_func); \
if(utest_handle_get()->failed_num != 0) return; if(utest_handle_get()->failed_num != 0) return;
#ifdef __cplusplus
}
#endif
#endif /* __UTEST_H__ */ #endif /* __UTEST_H__ */
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
#include "utest.h" #include "utest.h"
#include <rtthread.h> #include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
/* No need for the user to use this function directly */ /* No need for the user to use this function directly */
void utest_assert(int value, const char *file, int line, const char *func, const char *msg); void utest_assert(int value, const char *file, int line, const char *func, const char *msg);
...@@ -61,4 +65,8 @@ void utest_assert_buf(const char *a, const char *b, rt_size_t sz, rt_bool_t equa ...@@ -61,4 +65,8 @@ void utest_assert_buf(const char *a, const char *b, rt_size_t sz, rt_bool_t equa
#define uassert_in_range(value, min, max) __utest_assert(((value >= min) && (value <= max)), "(" #value ") not in range("#min","#max")") #define uassert_in_range(value, min, max) __utest_assert(((value >= min) && (value <= max)), "(" #value ") not in range("#min","#max")")
#define uassert_not_in_range(value, min, max) __utest_assert(!((value >= min) && (value <= max)), "(" #value ") in range("#min","#max")") #define uassert_not_in_range(value, min, max) __utest_assert(!((value >= min) && (value <= max)), "(" #value ") in range("#min","#max")")
#ifdef __cplusplus
}
#endif
#endif /* __UTEST_ASSERT_H__ */ #endif /* __UTEST_ASSERT_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册