Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ad762084
authored
8 years ago
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added missing signatures and documentation for thread priorities
parent
d6cf14ea
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
10 deletions
+78
-10
base_c/include/embb/base/c/thread.h
+3
-0
base_c/src/thread.c
+0
-6
base_cpp/include/embb/base/internal/thread-inl.h
+16
-1
base_cpp/include/embb/base/thread.h
+26
-1
mtapi_c/include/embb/mtapi/c/mtapi.h
+16
-2
mtapi_cpp/include/embb/mtapi/node_attributes.h
+17
-0
No files found.
base_c/include/embb/base/c/thread.h
View file @
ad762084
...
...
@@ -56,6 +56,9 @@ extern "C" {
typedef
opaque_type
embb_thread_t
;
#endif
/* DOXYGEN */
/**
* Thread priority type.
*/
typedef
enum
{
EMBB_THREAD_PRIORITY_IDLE
,
EMBB_THREAD_PRIORITY_LOWEST
,
...
...
This diff is collapsed.
Click to expand it.
base_c/src/thread.c
View file @
ad762084
...
...
@@ -207,12 +207,6 @@ int embb_thread_equal(const embb_thread_t* lhs, const embb_thread_t* rhs) {
return
0
;
}
int
embb_thread_set_priority
(
embb_thread_t
*
thread
,
embb_thread_priority_t
priority
)
{
}
#endif
/* EMBB_PLATFORM_THREADING_WINTHREADS */
#ifdef EMBB_PLATFORM_THREADING_POSIXTHREADS
...
...
This diff is collapsed.
Click to expand it.
base_cpp/include/embb/base/internal/thread-inl.h
View file @
ad762084
...
...
@@ -28,7 +28,6 @@
#define EMBB_BASE_INTERNAL_THREAD_INL_H_
#include <embb/base/exceptions.h>
#include <embb/base/c/thread.h>
#include <embb/base/internal/thread_closures.h>
#include <embb/base/memory_allocation.h>
#include <iostream>
...
...
@@ -60,6 +59,22 @@ Thread::Thread(CoreSet& core_set, Function function) : rep_() {
CheckThreadCreationErrors
(
result
,
closure
);
}
template
<
typename
Function
>
Thread
::
Thread
(
CoreSet
&
core_set
,
embb_thread_priority_t
priority
,
Function
function
)
:
rep_
()
{
typedef
internal
::
ThreadClosure
<
Function
>
Closure
;
Closure
*
closure
=
Allocation
::
New
<
Closure
>
(
function
);
int
result
=
embb_thread_create_with_priority
(
&
rep_
,
&
core_set
.
rep_
,
priority
,
internal
::
ThreadClosure
<
Function
>::
ThreadStart
,
static_cast
<
void
*>
(
closure
));
CheckThreadCreationErrors
(
result
,
closure
);
}
template
<
typename
Function
,
typename
Arg1
>
Thread
::
Thread
(
Function
function
,
Arg1
arg1
)
:
rep_
()
{
typedef
internal
::
ThreadClosureArg1
<
Function
,
Arg1
>
Closure
;
...
...
This diff is collapsed.
Click to expand it.
base_cpp/include/embb/base/thread.h
View file @
ad762084
...
...
@@ -31,6 +31,7 @@
#include <embb/base/internal/thread_closures.h>
#include <embb/base/mutex.h>
#include <embb/base/core_set.h>
#include <embb/base/c/thread.h>
#include <ostream>
namespace
embb
{
...
...
@@ -177,9 +178,33 @@ class Thread {
* \tparam Function Function object type
*/
template
<
typename
Function
>
explicit
Thread
(
Thread
(
CoreSet
&
core_set
,
/**< [IN] Set of cores on which the thread shall be executed. */
Function
function
/**< [IN] Copyable function object, callable without arguments */
);
/**
* Creates and runs a thread with zero-argument start function.
*
* \note If the function is passed as a temporary object when creating a
* thread, this might be interpreted as a function declaration ("most vexing
* parse"). C++11 resolves this by using curly braces for initialization.
*
* \throws NoMemoryException if not enough memory is available
* \throws ErrorException in case of another error
* \memory A small constant amount of memory to store the function. This
* memory is freed the thread is joined.
* \notthreadsafe
* \tparam Function Function object type
*/
template
<
typename
Function
>
Thread
(
CoreSet
&
core_set
,
/**< [IN] Set of cores on which the thread shall be executed. */
embb_thread_priority_t
priority
,
/**< [IN] Priority of the new thread. */
Function
function
/**< [IN] Copyable function object, callable without arguments */
);
...
...
This diff is collapsed.
Click to expand it.
mtapi_c/include/embb/mtapi/c/mtapi.h
View file @
ad762084
...
...
@@ -530,6 +530,9 @@ enum mtapi_notification_enum {
typedef
enum
mtapi_notification_enum
mtapi_notification_t
;
/**< runtime notification */
/**
* Enum to select default or specific worker for priority setter
*/
enum
mtapi_worker_priority_type_enum
{
MTAPI_WORKER_PRIORITY_END
=
0
,
MTAPI_WORKER_PRIORITY_DEFAULT
=
1
,
...
...
@@ -599,12 +602,23 @@ enum mtapi_worker_priority_type_enum {
MTAPI_WORKER_PRIORITY_WORKER_62
=
MTAPI_WORKER_PRIORITY_WORKER
+
62
,
MTAPI_WORKER_PRIORITY_WORKER_63
=
MTAPI_WORKER_PRIORITY_WORKER
+
63
};
/**
* Enum to select default or specific worker for priority setter
*/
typedef
enum
mtapi_worker_priority_type_enum
mtapi_worker_priority_type_t
;
/**
* Describes the default priority of all workers or the priority of a
* specific worker.
*/
struct
mtapi_worker_priority_entry_struct
{
mtapi_worker_priority_type_t
type
;
embb_thread_priority_t
priority
;
mtapi_worker_priority_type_t
type
;
/**< default or specific worker */
embb_thread_priority_t
priority
;
/**< priority to set */
};
/**
* Describes the default priority of all workers or the priority of a
* specific worker.
*/
typedef
struct
mtapi_worker_priority_entry_struct
mtapi_worker_priority_entry_t
;
/**
...
...
This diff is collapsed.
Click to expand it.
mtapi_cpp/include/embb/mtapi/node_attributes.h
View file @
ad762084
...
...
@@ -87,6 +87,23 @@ class NodeAttributes {
}
/**
* Sets the priority of the specified worker threads.
*
* \returns Reference to this object.
* \notthreadsafe
*/
NodeAttributes
&
SetWorkerPriority
(
mtapi_worker_priority_entry_t
*
worker_priorities
/**< Array of priorities */
)
{
mtapi_status_t
status
;
mtapi_nodeattr_set
(
&
attributes_
,
MTAPI_NODE_WORKER_PRIORITIES
,
worker_priorities
,
MTAPI_NODE_WORKER_PRIORITIES_SIZE
,
&
status
);
internal
::
CheckStatus
(
status
);
return
*
this
;
}
/**
* Sets the maximum number of concurrently active tasks.
*
* \returns Reference to this object.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment