[PATCH v2 2/3] librtemscxx: Fix white space to match the coding standard
chrisj at rtems.org
chrisj at rtems.org
Thu Oct 8 23:52:28 UTC 2020
From: Chris Johns <chrisj at rtems.org>
---
cpukit/include/rtems/error.hpp | 14 +-
cpukit/include/rtems/thread.hpp | 144 ++++++++++----------
cpukit/librtemscxx/error.cpp | 34 ++---
cpukit/librtemscxx/thread.cpp | 224 ++++++++++++++++----------------
4 files changed, 208 insertions(+), 208 deletions(-)
diff --git a/cpukit/include/rtems/error.hpp b/cpukit/include/rtems/error.hpp
index a62ee966c6..cb705826d4 100644
--- a/cpukit/include/rtems/error.hpp
+++ b/cpukit/include/rtems/error.hpp
@@ -50,19 +50,19 @@ namespace rtems
{
const rtems_status_code sc;
public:
- runtime_error (const rtems_status_code sc);
- runtime_error (const rtems_status_code sc, const std::string& what);
- runtime_error (const rtems_status_code sc, const char* what);
- ~runtime_error ();
+ runtime_error(const rtems_status_code sc);
+ runtime_error(const rtems_status_code sc, const std::string& what);
+ runtime_error(const rtems_status_code sc, const char* what);
+ ~runtime_error();
};
/**
* Throw a rtems::runtime_error exception if the RTEMS status code is
* not RTEMS_SUCCESSFUL.
*/
- void runtime_error_check (const rtems_status_code sc);
- void runtime_error_check (const rtems_status_code sc, const std::string& what);
- void runtime_error_check (const rtems_status_code sc, const char* what);
+ void runtime_error_check(const rtems_status_code sc);
+ void runtime_error_check(const rtems_status_code sc, const std::string& what);
+ void runtime_error_check(const rtems_status_code sc, const char* what);
};
#endif
diff --git a/cpukit/include/rtems/thread.hpp b/cpukit/include/rtems/thread.hpp
index fb408f60c0..cdef690740 100644
--- a/cpukit/include/rtems/thread.hpp
+++ b/cpukit/include/rtems/thread.hpp
@@ -83,14 +83,14 @@ namespace rtems
* executing thread. The stack size is set to the configured minimum
* stack size.
*/
- attributes ();
+ attributes();
/*
* Copy construct the thread attributes.
*
* @param attr The attributes to copy.
*/
- attributes (const attributes& attr);
+ attributes(const attributes& attr);
/**
* Set the name of the thread. The thread is a classic API thread and
@@ -98,7 +98,7 @@ namespace rtems
*
* @param name The name as a string.
*/
- void set_name (const std::string& name);
+ void set_name(const std::string& name);
/**
* Set the name of the thread. The thread is a classic API thread and
@@ -106,28 +106,28 @@ namespace rtems
*
* @param name The name as a string.
*/
- void set_name (const char* name);
+ void set_name(const char* name);
/**
* Get the name of the thread.
*
* @retval const std::string& The name of the thread.
*/
- const std::string& get_name () const;
+ const std::string& get_name() const;
/**
* Set the priority of the thread.
*
* @param priority The POSIX API priority of the thread.
*/
- void set_priority (int priority);
+ void set_priority(int priority);
/**
* Get the POSIX API priority of the thread.
*
* @retval int The POSIX API thread priority.
*/
- int get_priority () const;
+ int get_priority() const;
/**
* Set the stack size. If the size is less than the configured minimum
@@ -135,38 +135,38 @@ namespace rtems
*
* @param size The stack size in bytes.
*/
- void set_stack_size (size_t size);
+ void set_stack_size(size_t size);
/**
* Get the stack size.
*
* @retval size_t The stack size in bytes.
*/
- size_t get_stack_size () const;
+ size_t get_stack_size() const;
/**
* Set the scheduler name. If not set no scheduler is set.
*
* @parrm scheduler The name of the scheduler.
*/
- void set_scheduler (const std::string& scheduler);
+ void set_scheduler(const std::string& scheduler);
/**
* Set the scheduler name. If not set no scheduler is set.
*/
- void set_scheduler (const char* scheduler);
+ void set_scheduler(const char* scheduler);
/**
* Get scheduler name.
*/
- const std::string& get_scheduler ();
+ const std::string& get_scheduler();
/**
* Get the attributes' scheduler attribute for the thread.
*
* @return sched_attr The attributes' scheduler attribute
*/
- sched_attr get_scheduler_attr () const;
+ sched_attr get_scheduler_attr() const;
/**
* Set the scheduler policy for the thread. This call sets the
@@ -174,12 +174,12 @@ namespace rtems
*
* @param policy The scheduler policy.
*/
- void set_scheduler_policy (sched_policy policy);
+ void set_scheduler_policy(sched_policy policy);
/**
* Get the scheduler policy for the thread.
*/
- sched_policy get_scheduler_policy () const;
+ sched_policy get_scheduler_policy() const;
/**
* Commit any changes to the executing thread.
@@ -187,7 +187,7 @@ namespace rtems
* @note only the priority and attribute of a thread can be changed. The
* name and stack size are ignored.
*/
- void commit ();
+ void commit();
/**
* Update the attribute values from the executing thread. The attributes
@@ -197,18 +197,18 @@ namespace rtems
* this method is called. Except for the name and stack size any local
* changes made will lost then the update call is made.
*/
- void update ();
+ void update();
/**
* Copy operator.
*/
- attributes& operator= (const attributes& attr);
+ attributes& operator=(const attributes& attr);
/**
* The comparison operator does not check the name or stack size
* of a thread.
*/
- bool operator== (const attributes& attr) const;
+ bool operator==(const attributes& attr) const;
private:
std::string name; /**< Name of the thread */
@@ -243,7 +243,7 @@ namespace rtems
*/
class thread
{
- friend void* thread_generic_entry (void* arg);
+ friend void* thread_generic_entry(void* arg);
/**
* Base state class to interface to derived template of the thread
@@ -251,9 +251,9 @@ namespace rtems
*/
struct state_base
{
- virtual ~state_base ();
- virtual const attributes get_attributes () = 0;
- virtual void run () = 0;
+ virtual ~state_base();
+ virtual const attributes get_attributes() = 0;
+ virtual void run() = 0;
};
/**
@@ -278,23 +278,23 @@ namespace rtems
*/
class id {
public:
- id () noexcept : id_ (0) { }
- explicit id (pthread_t id_) : id_ (id_) { }
+ id() noexcept : id_(0) { }
+ explicit id(pthread_t id_) : id_(id_) { }
private:
pthread_t id_;
friend class thread;
- friend bool operator== (thread::id l, thread::id r) noexcept;
+ friend bool operator==(thread::id l, thread::id r) noexcept;
template<class CharT, class Traits>
friend std::basic_ostream<CharT, Traits>&
- operator<< (std::basic_ostream<CharT, Traits>& out, thread::id id_);
+ operator<<(std::basic_ostream<CharT, Traits>& out, thread::id id_);
};
/**
* The default thread constructions.
*/
- thread () noexcept = default;
+ thread() noexcept = default;
/**
* The std::thread equivalent constructor. The attributes will be the
@@ -302,7 +302,7 @@ namespace rtems
* configured minimum stack size.
*/
template<typename F, typename... Args>
- explicit thread (F&& func, Args&&... args);
+ explicit thread(F&& func, Args&&... args);
/**
* Create a thread with the provided attributes. The entry point and
@@ -310,12 +310,12 @@ namespace rtems
*/
template <typename A, typename F, typename ...Args,
class = enable_if_attributes<A>>
- explicit thread (A&& attr, F&& func, Args&&... args);
+ explicit thread(A&& attr, F&& func, Args&&... args);
/**
* Move the thread id to this instance.
*/
- thread& operator= (thread&& thread_);
+ thread& operator=(thread&& thread_);
void swap(thread& thread_) noexcept;
@@ -328,10 +328,10 @@ namespace rtems
/*
* Constrain use. These are not available.
*/
- thread (thread&) = delete;
- thread (const thread&) = delete;
- thread (const thread&&) = delete;
- thread& operator= (const thread&) = delete;
+ thread(thread&) = delete;
+ thread(const thread&) = delete;
+ thread(const thread&&) = delete;
+ thread& operator=(const thread&) = delete;
std::thread::id get_id() const noexcept;
@@ -349,20 +349,20 @@ namespace rtems
Parms p;
template<size_t Index>
- static std::__tuple_element_t<Index, Parms>&& declval ();
+ static std::__tuple_element_t<Index, Parms>&& declval();
template<size_t... Ind>
- auto invoke (std::_Index_tuple<Ind...>)
- noexcept (noexcept (std::invoke (declval<Ind>()...)))
- -> decltype (std::invoke (declval<Ind> ()...)) {
- return std::invoke (std::get<Ind> (std::move (p))...);
+ auto invoke(std::_Index_tuple<Ind...>)
+ noexcept(noexcept(std::invoke(declval<Ind>()...)))
+ -> decltype(std::invoke(declval<Ind>()...)) {
+ return std::invoke(std::get<Ind>(std::move(p))...);
}
using indices =
typename std::_Build_index_tuple<std::tuple_size<Parms>::value>::__type;
- void run () {
- invoke (indices ());
+ void run() {
+ invoke(indices());
}
};
@@ -376,17 +376,17 @@ namespace rtems
const attributes attr;
Invoker i;
- state (const attributes& attr, Invoker&& i)
- : attr (attr),
- i (std::forward<Invoker> (i)) {
+ state(const attributes& attr, Invoker&& i)
+ : attr(attr),
+ i(std::forward<Invoker>(i)) {
}
- const attributes get_attributes () override {
+ const attributes get_attributes() override {
return attr;
}
- void run () override {
- i.run ();
+ void run() override {
+ i.run();
}
};
@@ -396,9 +396,9 @@ namespace rtems
*/
template<typename Invoker>
static state_ptr
- make_state (const attributes& attr, Invoker&& i) {
+ make_state(const attributes& attr, Invoker&& i) {
using state_impl = state<Invoker>;
- return state_ptr{ new state_impl (attr, std::forward<Invoker> (i)) };
+ return state_ptr{ new state_impl(attr, std::forward<Invoker>(i)) };
}
/**
@@ -413,11 +413,11 @@ namespace rtems
*/
template<typename F, typename... Args>
static invoker<decayed_tuple<F, Args...>>
- make_invoker (F&& func, Args&&... args)
+ make_invoker(F&& func, Args&&... args)
{
return {
decayed_tuple<F, Args...> {
- std::forward<F> (func), std::forward<Args> (args)...
+ std::forward<F>(func), std::forward<Args>(args)...
}
};
}
@@ -425,55 +425,55 @@ namespace rtems
/**
* Create and start the thread.
*/
- void start_thread (state_ptr s);
+ void start_thread(state_ptr s);
};
template <class T>
inline typename std::decay<T>::type
- decay_copy (T&& t) {
- return std::forward<T> (t);
+ decay_copy(T&& t) {
+ return std::forward<T>(t);
}
template<typename F, typename... Args>
- thread::thread (F&& func, Args&&... args)
- : id_ (0) {
+ thread::thread(F&& func, Args&&... args)
+ : id_(0) {
attributes attr;
- start_thread (
- make_state (attr,
- make_invoker (decay_copy (std::forward<F> (func)),
- decay_copy (std::forward<Args> (args))...))
+ start_thread(
+ make_state(attr,
+ make_invoker(decay_copy(std::forward<F>(func)),
+ decay_copy(std::forward<Args>(args))...))
);
}
template<typename A, typename F, typename... Args,
class = thread::enable_if_attributes<A>>
- thread::thread (A&& attr, F&& func, Args&&... args)
- : id_ (0) {
- start_thread (
- make_state (attr,
- make_invoker (decay_copy (std::forward<F> (func)),
- decay_copy (std::forward<Args> (args))...))
+ thread::thread(A&& attr, F&& func, Args&&... args)
+ : id_(0) {
+ start_thread(
+ make_state(attr,
+ make_invoker(decay_copy(std::forward<F>(func)),
+ decay_copy(std::forward<Args>(args))...))
);
}
inline std::thread::id thread::get_id() const noexcept {
- return std::thread::id (id_.id_);
+ return std::thread::id(id_.id_);
}
inline bool
- operator== (thread::id l, thread::id r) noexcept {
+ operator==(thread::id l, thread::id r) noexcept {
return l.id_ == r.id_;
}
inline bool
- operator!= (thread::id l, thread::id r) noexcept {
+ operator!=(thread::id l, thread::id r) noexcept {
return !(l == r);
}
template<class C, class T>
inline std::basic_ostream<C, T>&
- operator<< (std::basic_ostream<C, T>& out, thread::id id_) {
- return out << std::thread::id (id_.id_);
+ operator<<(std::basic_ostream<C, T>& out, thread::id id_) {
+ return out << std::thread::id(id_.id_);
}
};
};
diff --git a/cpukit/librtemscxx/error.cpp b/cpukit/librtemscxx/error.cpp
index 8723856ac9..77d4910b52 100644
--- a/cpukit/librtemscxx/error.cpp
+++ b/cpukit/librtemscxx/error.cpp
@@ -29,23 +29,23 @@
namespace rtems
{
- runtime_error::runtime_error (const rtems_status_code sc)
- : std::runtime_error (::rtems_status_text (sc)),
- sc (sc)
+ runtime_error::runtime_error(const rtems_status_code sc)
+ : std::runtime_error(::rtems_status_text(sc)),
+ sc(sc)
{
}
- runtime_error::runtime_error (const rtems_status_code sc,
- const std::string& what)
- : std::runtime_error (what + ": " + ::rtems_status_text (sc)),
- sc (sc)
+ runtime_error::runtime_error(const rtems_status_code sc,
+ const std::string& what)
+ : std::runtime_error(what + ": " + ::rtems_status_text(sc)),
+ sc(sc)
{
}
- runtime_error::runtime_error (const rtems_status_code sc,
- const char* what)
- : std::runtime_error (std::string (what) + ": " + ::rtems_status_text (sc)),
- sc (sc)
+ runtime_error::runtime_error(const rtems_status_code sc,
+ const char* what)
+ : std::runtime_error(std::string(what) + ": " + ::rtems_status_text(sc)),
+ sc(sc)
{
}
@@ -54,26 +54,26 @@ namespace rtems
}
void
- runtime_error_check (const rtems_status_code sc)
+ runtime_error_check(const rtems_status_code sc)
{
if (sc != RTEMS_SUCCESSFUL) {
- throw runtime_error (sc);
+ throw runtime_error(sc);
}
}
void
- runtime_error_check (const rtems_status_code sc, const std::string& what)
+ runtime_error_check(const rtems_status_code sc, const std::string& what)
{
if (sc != RTEMS_SUCCESSFUL) {
- throw runtime_error (sc, what);
+ throw runtime_error(sc, what);
}
}
void
- runtime_error_check (const rtems_status_code sc, const char* what)
+ runtime_error_check(const rtems_status_code sc, const char* what)
{
if (sc != RTEMS_SUCCESSFUL) {
- throw runtime_error (sc, what);
+ throw runtime_error(sc, what);
}
}
};
diff --git a/cpukit/librtemscxx/thread.cpp b/cpukit/librtemscxx/thread.cpp
index 7ef9d6ac30..bfc2b84925 100644
--- a/cpukit/librtemscxx/thread.cpp
+++ b/cpukit/librtemscxx/thread.cpp
@@ -39,11 +39,11 @@
#include <rtems.h>
#if HAVE_GET_SCHEDULER_NAME
-extern "C" bool get_scheduler_name (rtems_id sid, char* name);
+extern "C" bool get_scheduler_name(rtems_id sid, char* name);
#endif
#if HAVE_GET_SCHEDULER_NAME
-bool get_scheduler_name (rtems_id sid, char* name)
+bool get_scheduler_name(rtems_id sid, char* name)
{
name[0] = 'N';
name[1] = 'O';
@@ -58,58 +58,58 @@ namespace rtems
namespace thread
{
void
- system_error_check (int ec, const char* what)
+ system_error_check(int ec, const char* what)
{
if (ec != 0) {
- throw std::system_error (ec, std::system_category(), what);
+ throw std::system_error(ec, std::system_category(), what);
}
}
- attributes::attributes ()
- : priority (-1),
- stack_size (RTEMS_MINIMUM_STACK_SIZE),
- attr (sched_inherit),
- policy (sched_fifo)
+ attributes::attributes()
+ : priority(-1),
+ stack_size(RTEMS_MINIMUM_STACK_SIZE),
+ attr(sched_inherit),
+ policy(sched_fifo)
{
- update ();
+ update();
}
- attributes::attributes (const attributes& attr)
- : name (attr.name),
- priority (attr.priority),
- stack_size (attr.stack_size),
- scheduler (attr.scheduler),
- attr (attr.attr),
- policy (attr.policy)
+ attributes::attributes(const attributes& attr)
+ : name(attr.name),
+ priority(attr.priority),
+ stack_size(attr.stack_size),
+ scheduler(attr.scheduler),
+ attr(attr.attr),
+ policy(attr.policy)
{
}
void
- attributes::set_name (const std::string& name_)
+ attributes::set_name(const std::string& name_)
{
name = name_;
}
void
- attributes::set_name (const char* name_)
+ attributes::set_name(const char* name_)
{
name = name_;
}
const std::string&
- attributes::get_name () const
+ attributes::get_name() const
{
return name;
}
void
- attributes::set_priority (int priority_)
+ attributes::set_priority(int priority_)
{
priority = priority_;
}
int
- attributes::get_priority () const
+ attributes::get_priority() const
{
return priority;
}
@@ -121,63 +121,63 @@ namespace rtems
}
size_t
- attributes::get_stack_size () const
+ attributes::get_stack_size() const
{
return stack_size;
}
void
- attributes::set_scheduler (const std::string& scheduler_)
+ attributes::set_scheduler(const std::string& scheduler_)
{
scheduler = scheduler_;
}
void
- attributes::set_scheduler (const char* scheduler_)
+ attributes::set_scheduler(const char* scheduler_)
{
scheduler = scheduler_;
}
const std::string&
- attributes::get_scheduler ()
+ attributes::get_scheduler()
{
return scheduler;
}
attributes::sched_attr
- attributes::get_scheduler_attr () const
+ attributes::get_scheduler_attr() const
{
return attr;
}
void
- attributes::set_scheduler_policy (sched_policy policy_)
+ attributes::set_scheduler_policy(sched_policy policy_)
{
attr = sched_explicit;
policy = policy_;
}
attributes::sched_policy
- attributes::get_scheduler_policy () const
+ attributes::get_scheduler_policy() const
{
return policy;
}
void
- attributes::commit ()
+ attributes::commit()
{
- pthread_t pid = ::pthread_self ();
+ pthread_t pid = ::pthread_self();
- system_error_check (::pthread_setname_np (pid, name.c_str ()),
- "getting name");
+ system_error_check(::pthread_setname_np(pid, name.c_str()),
+ "getting name");
int spolicy;
struct sched_param sched_param;
- system_error_check (::pthread_getschedparam (::pthread_self (),
- &spolicy,
- &sched_param),
- "getting scheduler parameters");
+ system_error_check(::pthread_getschedparam(::pthread_self(),
+ &spolicy,
+ &sched_param),
+ "getting scheduler parameters");
switch (policy) {
case sched_other:
@@ -193,33 +193,33 @@ namespace rtems
spolicy = SCHED_SPORADIC;
break;
default:
- system_error_check (EINVAL, "get scheduler policy");
+ system_error_check(EINVAL, "get scheduler policy");
break;
}
sched_param.sched_priority = priority;
- system_error_check (::pthread_setschedparam (::pthread_self (),
- spolicy,
- &sched_param),
- "getting scheduler parameters");
+ system_error_check(::pthread_setschedparam(::pthread_self(),
+ spolicy,
+ &sched_param),
+ "getting scheduler parameters");
- if (!scheduler.empty ()) {
+ if (!scheduler.empty()) {
char sname[4] = { ' ', ' ', ' ', ' ' };
- for (size_t c = 0; c < sizeof (sname); ++c) {
- if (c >= scheduler.length ()) {
+ for (size_t c = 0; c < sizeof(sname); ++c) {
+ if (c >= scheduler.length()) {
break;
}
sname[c] = scheduler[c];
}
- rtems_name scheduler_name = rtems_build_name (sname[0],
- sname[1],
- sname[2],
- sname[3]);
+ rtems_name scheduler_name = rtems_build_name(sname[0],
+ sname[1],
+ sname[2],
+ sname[3]);
rtems_id scheduler_id;
- runtime_error_check (::rtems_scheduler_ident (scheduler_name,
- &scheduler_id),
- "get scheduler id");
+ runtime_error_check(::rtems_scheduler_ident(scheduler_name,
+ &scheduler_id),
+ "get scheduler id");
// runtime_error_check (::rtems_task_set_scheduler (RTEMS_SELF,
// scheduler_id,
// 1),
@@ -228,21 +228,21 @@ namespace rtems
}
void
- attributes::update ()
+ attributes::update()
{
char buf[32];
- system_error_check (::pthread_getname_np (::pthread_self (),
- buf,
- sizeof (buf)),
- "getting name");
+ system_error_check(::pthread_getname_np(::pthread_self(),
+ buf,
+ sizeof (buf)),
+ "getting name");
name = buf;
int spolicy;
struct sched_param sched_param;
- system_error_check (::pthread_getschedparam (::pthread_self (),
- &spolicy,
- &sched_param),
- "getting scheduler parameters");
+ system_error_check(::pthread_getschedparam(::pthread_self(),
+ &spolicy,
+ &sched_param),
+ "getting scheduler parameters");
switch (spolicy) {
case SCHED_OTHER:
@@ -258,19 +258,19 @@ namespace rtems
policy = sched_sporadic;
break;
default:
- system_error_check (EINVAL, "get scheduler policy");
+ system_error_check(EINVAL, "get scheduler policy");
break;
}
priority = sched_param.sched_priority;
pthread_attr_t pattr;
- system_error_check (::pthread_getattr_np (::pthread_self (), &pattr),
- "getting thread attributes");
- system_error_check (::pthread_attr_getstacksize (&pattr, &stack_size),
- "getting stack size");
+ system_error_check(::pthread_getattr_np(::pthread_self(), &pattr),
+ "getting thread attributes");
+ system_error_check(::pthread_attr_getstacksize(&pattr, &stack_size),
+ "getting stack size");
int inheritsched = 0;
- system_error_check (::pthread_attr_getinheritsched (&pattr, &inheritsched),
- "getting inherited sheduler attribute");
+ system_error_check(::pthread_attr_getinheritsched(&pattr, &inheritsched),
+ "getting inherited sheduler attribute");
switch (inheritsched) {
case PTHREAD_INHERIT_SCHED:
attr = sched_inherit;
@@ -279,23 +279,23 @@ namespace rtems
attr = sched_explicit;
break;
default:
- system_error_check (EINVAL, "get scheduler attribute");
+ system_error_check(EINVAL, "get scheduler attribute");
break;
}
rtems_id scheduler_id;
- runtime_error_check (::rtems_task_get_scheduler (RTEMS_SELF, &scheduler_id));
+ runtime_error_check(::rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id));
#if HAVE_GET_SCHEDULER_NAME
char name[5];
- if (!get_scheduler_name (scheduler_id, &name[0])) {
- system_error_check (ENOENT, "get scheduler name");
+ if (!get_scheduler_name(scheduler_id, &name[0])) {
+ system_error_check(ENOENT, "get scheduler name");
}
scheduler = name;
#endif
}
attributes&
- attributes::operator= (const attributes& other)
+ attributes::operator=(const attributes& other)
{
name = other.name;
priority = other.priority;
@@ -306,7 +306,7 @@ namespace rtems
}
bool
- attributes::operator== (const attributes& other) const
+ attributes::operator==(const attributes& other) const
{
return
name == other.name &&
@@ -317,22 +317,22 @@ namespace rtems
}
void*
- thread_generic_entry (void* arg)
+ thread_generic_entry(void* arg)
{
- thread::state_ptr s{ static_cast<thread::state_base*> (arg) };
+ thread::state_ptr s{ static_cast<thread::state_base*>(arg) };
try {
- s->run ();
+ s->run();
} catch (...) {
- std::terminate ();
+ std::terminate();
}
return nullptr;
}
thread&
- thread::operator= (thread&& thread_)
+ thread::operator=(thread&& thread_)
{
- if (joinable ()) {
- std::terminate ();
+ if (joinable()) {
+ std::terminate();
}
swap(thread_);
return *this;
@@ -354,9 +354,9 @@ namespace rtems
thread::join()
{
if (!joinable()) {
- system_error_check (EINVAL, "join");
+ system_error_check(EINVAL, "join");
}
- system_error_check (::pthread_join (id_.id_, nullptr), "join");
+ system_error_check(::pthread_join(id_.id_, nullptr), "join");
id_ = id();
}
@@ -364,31 +364,31 @@ namespace rtems
thread::detach()
{
if (!joinable()) {
- system_error_check (EINVAL, "detach");
+ system_error_check(EINVAL, "detach");
}
- system_error_check (::pthread_detach (id_.id_), "detach");
+ system_error_check(::pthread_detach(id_.id_), "detach");
id_ = id();
}
- thread::state_base::~state_base () = default;
+ thread::state_base::~state_base() = default;
void
- thread::start_thread (thread::state_ptr s)
+ thread::start_thread(thread::state_ptr s)
{
- const attributes attr = s->get_attributes ();
+ const attributes attr = s->get_attributes();
pthread_attr_t pattr;
- system_error_check (::pthread_attr_init (&pattr),
- "attribute init");
+ system_error_check(::pthread_attr_init(&pattr),
+ "attribute init");
struct sched_param param;
- param.sched_priority = attr.get_priority ();
- system_error_check (::pthread_attr_setschedparam (&pattr, ¶m),
- "set sched param");
+ param.sched_priority = attr.get_priority();
+ system_error_check(::pthread_attr_setschedparam(&pattr, ¶m),
+ "set sched param");
int spolicy;
- switch (attr.get_scheduler_policy ()) {
+ switch (attr.get_scheduler_policy()) {
case attributes::sched_other:
spolicy = SCHED_OTHER;
break;
@@ -402,37 +402,37 @@ namespace rtems
spolicy = SCHED_FIFO;
break;
}
- system_error_check (::pthread_attr_setschedpolicy (&pattr, spolicy),
- "set scheduler policy");
+ system_error_check(::pthread_attr_setschedpolicy(&pattr, spolicy),
+ "set scheduler policy");
- if (attr.get_scheduler_attr () == attributes::sched_inherit) {
- ::pthread_attr_setinheritsched (&pattr, PTHREAD_INHERIT_SCHED);
+ if (attr.get_scheduler_attr() == attributes::sched_inherit) {
+ ::pthread_attr_setinheritsched(&pattr, PTHREAD_INHERIT_SCHED);
}
else {
- ::pthread_attr_setinheritsched (&pattr, PTHREAD_EXPLICIT_SCHED);
+ ::pthread_attr_setinheritsched(&pattr, PTHREAD_EXPLICIT_SCHED);
}
- system_error_check (::pthread_attr_setstacksize(&pattr,
- attr.get_stack_size ()),
- "set stack size");
+ system_error_check(::pthread_attr_setstacksize(&pattr,
+ attr.get_stack_size()),
+ "set stack size");
/*
* Hold the new thread in the state's run handler until the rest
* of the thread is set up after the create call.
*/
- system_error_check (::pthread_create (&id_.id_,
- &pattr,
- thread_generic_entry,
- s.get ()),
- "create thread");
+ system_error_check(::pthread_create(&id_.id_,
+ &pattr,
+ thread_generic_entry,
+ s.get()),
+ "create thread");
- system_error_check (::pthread_setname_np (id_.id_,
- attr.get_name ().c_str ()),
- "setting thread name");
+ system_error_check(::pthread_setname_np(id_.id_,
+ attr.get_name().c_str()),
+ "setting thread name");
- ::pthread_attr_destroy (&pattr);
+ ::pthread_attr_destroy(&pattr);
- s.release ();
+ s.release();
};
};
};
--
2.24.1
More information about the devel
mailing list