Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
advLigoRTS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
CDS
software
advLigoRTS
Commits
eebe50d4
Commit
eebe50d4
authored
4 years ago
by
Jonathan Hanks
Browse files
Options
Downloads
Patches
Plain Diff
Updating comments in daqd_thread.hh
parent
cd052e2b
No related branches found
Branches containing commit
No related tags found
1 merge request
!115
Daqd not exiting issue 96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/daqd/daqd_thread.hh
+45
-13
45 additions, 13 deletions
src/daqd/daqd_thread.hh
with
45 additions
and
13 deletions
src/daqd/daqd_thread.hh
+
45
−
13
View file @
eebe50d4
...
...
@@ -27,12 +27,19 @@ extern int launch_pthread( pthread_t& tid,
const
pthread_attr_t
&
attr
,
thread_action_t
handler
);
/*!
* @brief wrap the pthread scope macros in a enum to
* bring them into the C++ type system.
*/
enum
class
thread_scope_t
{
SYSTEM
=
PTHREAD_SCOPE_SYSTEM
,
PROCESS
=
PTHREAD_SCOPE_PROCESS
,
};
/*!
* @brief a strong type for a stacksize.
*/
class
thread_stacksize_t
{
public:
...
...
@@ -60,19 +67,29 @@ private:
/*!
* @brief a RAII wrapper for pthread_attr_t, ensuring that it is always
* destroyed.
* destroyed. The constructor also uses strong types to all an arbitrary
* set of attributes to be set at construction time.
*/
class
thread_attr_t
{
class
thread_attr_t
{
public:
thread_attr_t
()
:
attr_
{}
{
pthread_attr_init
(
&
attr_
);
thread_attr_t
(
)
:
attr_
{}
{
pthread_attr_init
(
&
attr_
);
}
template
<
typename
T
,
typename
...
Args
>
explicit
thread_attr_t
(
T
t
,
Args
...
args
)
:
attr_
{}
/*!
* @brief construct a thread_attr_t and set attributes on it.
* @tparam T one of the attribute types that can be set
* @tparam Args list of additional attribute types
* @param t the first attribute to set
* @param args additional (0 or more) attributes to set
*/
template
<
typename
T
,
typename
...
Args
>
explicit
thread_attr_t
(
T
t
,
Args
...
args
)
:
attr_
{}
{
pthread_attr_init
(
&
attr_
);
set
(
t
,
args
...);
pthread_attr_init
(
&
attr_
);
set
(
t
,
args
...
);
}
thread_attr_t
(
const
thread_attr_t
&
)
=
delete
;
...
...
@@ -86,22 +103,37 @@ public:
thread_attr_t
&
operator
=
(
const
thread_attr_t
&
)
=
delete
;
thread_attr_t
&
operator
=
(
thread_attr_t
&&
)
=
delete
;
/*!
* @brief set the PTHREAD_SCOPE value
* @param scope the scope value as an enum
*/
void
set
(
thread_scope_t
scope
)
{
pthread_attr_setscope
(
&
attr_
,
static_cast
<
int
>
(
scope
)
);
}
/*!
* @brief set the stack size
* @param stack_size the size of the stack
*/
void
set
(
thread_stacksize_t
stack_size
)
{
pthread_attr_setstacksize
(
&
attr_
,
stack_size
.
get
(
)
);
}
template
<
typename
T
,
typename
...
Args
>
/*!
* @brief take an arbitrary list of attribute types and set them.
* @tparam T First attribute type to set
* @tparam Args Additional (0+) types of attributes
* @param t the first attribute
* @param args additional attributes
*/
template
<
typename
T
,
typename
...
Args
>
void
set
(
T
t
,
Args
...
args
)
set
(
T
t
,
Args
...
args
)
{
set
(
t
);
set
(
args
...);
set
(
t
);
set
(
args
...
);
}
pthread_attr_t
&
...
...
@@ -155,7 +187,7 @@ public:
thread_ids_
.
swap
(
ids
);
}
void
clear
();
void
clear
(
);
private
:
std
::
vector
<
pthread_t
>
thread_ids_
{};
...
...
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