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
Jul 07, 2016
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added missing signatures and documentation for thread priorities
parent
d6cf14ea
Hide 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" {
...
@@ -56,6 +56,9 @@ extern "C" {
typedef
opaque_type
embb_thread_t
;
typedef
opaque_type
embb_thread_t
;
#endif
/* DOXYGEN */
#endif
/* DOXYGEN */
/**
* Thread priority type.
*/
typedef
enum
{
typedef
enum
{
EMBB_THREAD_PRIORITY_IDLE
,
EMBB_THREAD_PRIORITY_IDLE
,
EMBB_THREAD_PRIORITY_LOWEST
,
EMBB_THREAD_PRIORITY_LOWEST
,
...
...
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) {
...
@@ -207,12 +207,6 @@ int embb_thread_equal(const embb_thread_t* lhs, const embb_thread_t* rhs) {
return
0
;
return
0
;
}
}
int
embb_thread_set_priority
(
embb_thread_t
*
thread
,
embb_thread_priority_t
priority
)
{
}
#endif
/* EMBB_PLATFORM_THREADING_WINTHREADS */
#endif
/* EMBB_PLATFORM_THREADING_WINTHREADS */
#ifdef EMBB_PLATFORM_THREADING_POSIXTHREADS
#ifdef EMBB_PLATFORM_THREADING_POSIXTHREADS
...
...
base_cpp/include/embb/base/internal/thread-inl.h
View file @
ad762084
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#define EMBB_BASE_INTERNAL_THREAD_INL_H_
#define EMBB_BASE_INTERNAL_THREAD_INL_H_
#include <embb/base/exceptions.h>
#include <embb/base/exceptions.h>
#include <embb/base/c/thread.h>
#include <embb/base/internal/thread_closures.h>
#include <embb/base/internal/thread_closures.h>
#include <embb/base/memory_allocation.h>
#include <embb/base/memory_allocation.h>
#include <iostream>
#include <iostream>
...
@@ -60,6 +59,22 @@ Thread::Thread(CoreSet& core_set, Function function) : rep_() {
...
@@ -60,6 +59,22 @@ Thread::Thread(CoreSet& core_set, Function function) : rep_() {
CheckThreadCreationErrors
(
result
,
closure
);
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
>
template
<
typename
Function
,
typename
Arg1
>
Thread
::
Thread
(
Function
function
,
Arg1
arg1
)
:
rep_
()
{
Thread
::
Thread
(
Function
function
,
Arg1
arg1
)
:
rep_
()
{
typedef
internal
::
ThreadClosureArg1
<
Function
,
Arg1
>
Closure
;
typedef
internal
::
ThreadClosureArg1
<
Function
,
Arg1
>
Closure
;
...
...
base_cpp/include/embb/base/thread.h
View file @
ad762084
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <embb/base/internal/thread_closures.h>
#include <embb/base/internal/thread_closures.h>
#include <embb/base/mutex.h>
#include <embb/base/mutex.h>
#include <embb/base/core_set.h>
#include <embb/base/core_set.h>
#include <embb/base/c/thread.h>
#include <ostream>
#include <ostream>
namespace
embb
{
namespace
embb
{
...
@@ -177,9 +178,33 @@ class Thread {
...
@@ -177,9 +178,33 @@ class Thread {
* \tparam Function Function object type
* \tparam Function Function object type
*/
*/
template
<
typename
Function
>
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
,
CoreSet
&
core_set
,
/**< [IN] Set of cores on which the thread shall be executed. */
/**< [IN] Set of cores on which the thread shall be executed. */
embb_thread_priority_t
priority
,
/**< [IN] Priority of the new thread. */
Function
function
Function
function
/**< [IN] Copyable function object, callable without arguments */
/**< [IN] Copyable function object, callable without arguments */
);
);
...
...
mtapi_c/include/embb/mtapi/c/mtapi.h
View file @
ad762084
...
@@ -530,6 +530,9 @@ enum mtapi_notification_enum {
...
@@ -530,6 +530,9 @@ enum mtapi_notification_enum {
typedef
enum
mtapi_notification_enum
mtapi_notification_t
;
typedef
enum
mtapi_notification_enum
mtapi_notification_t
;
/**< runtime notification */
/**< runtime notification */
/**
* Enum to select default or specific worker for priority setter
*/
enum
mtapi_worker_priority_type_enum
{
enum
mtapi_worker_priority_type_enum
{
MTAPI_WORKER_PRIORITY_END
=
0
,
MTAPI_WORKER_PRIORITY_END
=
0
,
MTAPI_WORKER_PRIORITY_DEFAULT
=
1
,
MTAPI_WORKER_PRIORITY_DEFAULT
=
1
,
...
@@ -599,12 +602,23 @@ enum mtapi_worker_priority_type_enum {
...
@@ -599,12 +602,23 @@ enum mtapi_worker_priority_type_enum {
MTAPI_WORKER_PRIORITY_WORKER_62
=
MTAPI_WORKER_PRIORITY_WORKER
+
62
,
MTAPI_WORKER_PRIORITY_WORKER_62
=
MTAPI_WORKER_PRIORITY_WORKER
+
62
,
MTAPI_WORKER_PRIORITY_WORKER_63
=
MTAPI_WORKER_PRIORITY_WORKER
+
63
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
;
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
{
struct
mtapi_worker_priority_entry_struct
{
mtapi_worker_priority_type_t
type
;
mtapi_worker_priority_type_t
type
;
/**< default or specific worker */
embb_thread_priority_t
priority
;
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
;
typedef
struct
mtapi_worker_priority_entry_struct
mtapi_worker_priority_entry_t
;
/**
/**
...
...
mtapi_cpp/include/embb/mtapi/node_attributes.h
View file @
ad762084
...
@@ -87,6 +87,23 @@ class NodeAttributes {
...
@@ -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.
* Sets the maximum number of concurrently active tasks.
*
*
* \returns Reference to this object.
* \returns Reference to this object.
...
...
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