Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
93770edc
Commit
93770edc
authored
8 years ago
by
Joseph Noir
Committed by
Oleg Hahm
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cpp11-compat: address cppcheck warnings
parent
a9cc8bab
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sys/cpp11-compat/include/riot/chrono.hpp
+1
-1
1 addition, 1 deletion
sys/cpp11-compat/include/riot/chrono.hpp
sys/cpp11-compat/include/riot/thread.hpp
+6
-5
6 additions, 5 deletions
sys/cpp11-compat/include/riot/thread.hpp
with
7 additions
and
6 deletions
sys/cpp11-compat/include/riot/chrono.hpp
+
1
−
1
View file @
93770edc
...
@@ -52,7 +52,7 @@ class time_point {
...
@@ -52,7 +52,7 @@ class time_point {
/**
/**
* @brief Create time point from timex_t struct.
* @brief Create time point from timex_t struct.
*/
*/
inline
time_point
(
timex_t
&&
tp
)
:
m_handle
(
tp
)
{}
explicit
inline
time_point
(
timex_t
&&
tp
)
:
m_handle
(
tp
)
{}
/**
/**
* @brief Use default copy constructor.
* @brief Use default copy constructor.
*/
*/
...
...
This diff is collapsed.
Click to expand it.
sys/cpp11-compat/include/riot/thread.hpp
+
6
−
5
View file @
93770edc
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include
"time.h"
#include
"time.h"
#include
"thread.h"
#include
"thread.h"
#include
<array>
#include
<tuple>
#include
<tuple>
#include
<atomic>
#include
<atomic>
#include
<memory>
#include
<memory>
...
@@ -65,7 +66,7 @@ struct thread_data {
...
@@ -65,7 +66,7 @@ struct thread_data {
/** @cond INTERNAL */
/** @cond INTERNAL */
std
::
atomic
<
unsigned
>
ref_count
;
std
::
atomic
<
unsigned
>
ref_count
;
kernel_pid_t
joining_thread
;
kernel_pid_t
joining_thread
;
char
stack
[
stack_size
]
;
std
::
array
<
char
,
stack
_size
>
stack
;
/** @endcond */
/** @endcond */
};
};
...
@@ -106,7 +107,7 @@ public:
...
@@ -106,7 +107,7 @@ public:
/**
/**
* @brief Create a thread id from a native handle.
* @brief Create a thread id from a native handle.
*/
*/
inline
thread_id
(
kernel_pid_t
handle
)
:
m_handle
{
handle
}
{}
explicit
inline
thread_id
(
kernel_pid_t
handle
)
:
m_handle
{
handle
}
{}
/**
/**
* @brief Comparison operator for thread ids.
* @brief Comparison operator for thread ids.
...
@@ -164,7 +165,7 @@ namespace this_thread {
...
@@ -164,7 +165,7 @@ namespace this_thread {
/**
/**
* @brief Access the id of the currently running thread.
* @brief Access the id of the currently running thread.
*/
*/
inline
thread_id
get_id
()
noexcept
{
return
thread_getpid
();
}
inline
thread_id
get_id
()
noexcept
{
return
thread_id
{
thread_getpid
()
}
;
}
/**
/**
* @brief Yield the currently running thread.
* @brief Yield the currently running thread.
*/
*/
...
@@ -286,7 +287,7 @@ public:
...
@@ -286,7 +287,7 @@ public:
/**
/**
* @brief Returns the id of a thread.
* @brief Returns the id of a thread.
*/
*/
inline
id
get_id
()
const
noexcept
{
return
m_handle
;
}
inline
id
get_id
()
const
noexcept
{
return
thread_id
{
m_handle
}
;
}
/**
/**
* @brief Returns the native handle to a thread.
* @brief Returns the native handle to a thread.
*/
*/
...
@@ -345,7 +346,7 @@ thread::thread(F&& f, Args&&... args)
...
@@ -345,7 +346,7 @@ thread::thread(F&& f, Args&&... args)
unique_ptr
<
func_and_args
>
p
(
unique_ptr
<
func_and_args
>
p
(
new
func_and_args
(
m_data
.
get
(),
forward
<
F
>
(
f
),
forward
<
Args
>
(
args
)...));
new
func_and_args
(
m_data
.
get
(),
forward
<
F
>
(
f
),
forward
<
Args
>
(
args
)...));
m_handle
=
thread_create
(
m_handle
=
thread_create
(
m_data
->
stack
,
stack_size
,
THREAD_PRIORITY_MAIN
-
1
,
0
,
m_data
->
stack
.
data
()
,
stack_size
,
THREAD_PRIORITY_MAIN
-
1
,
0
,
&
thread_proxy
<
func_and_args
>
,
p
.
get
(),
"riot_cpp_thread"
);
&
thread_proxy
<
func_and_args
>
,
p
.
get
(),
"riot_cpp_thread"
);
if
(
m_handle
>=
0
)
{
if
(
m_handle
>=
0
)
{
p
.
release
();
p
.
release
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment