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
ed1c83f6
authored
9 years ago
by
Marcus Winter
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'embb436_tasks_group_creation_thread_safety' into development
parents
eec3dd7d
7aa7fb0f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
tasks_cpp/include/embb/tasks/node.h
+3
-0
tasks_cpp/src/node.cc
+9
-0
No files found.
tasks_cpp/include/embb/tasks/node.h
View file @
ed1c83f6
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <list>
#include <list>
#include <embb/base/core_set.h>
#include <embb/base/core_set.h>
#include <embb/base/mutex.h>
#include <embb/mtapi/c/mtapi.h>
#include <embb/mtapi/c/mtapi.h>
#include <embb/tasks/action.h>
#include <embb/tasks/action.h>
#include <embb/tasks/task.h>
#include <embb/tasks/task.h>
...
@@ -233,6 +234,8 @@ class Node {
...
@@ -233,6 +234,8 @@ class Node {
mtapi_action_hndl_t
action_handle_
;
mtapi_action_hndl_t
action_handle_
;
std
::
list
<
Queue
*>
queues_
;
std
::
list
<
Queue
*>
queues_
;
std
::
list
<
Group
*>
groups_
;
std
::
list
<
Group
*>
groups_
;
embb
::
base
::
Spinlock
queue_lock_
;
embb
::
base
::
Spinlock
group_lock_
;
};
};
}
// namespace tasks
}
// namespace tasks
...
...
This diff is collapsed.
Click to expand it.
tasks_cpp/src/node.cc
View file @
ed1c83f6
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <embb/base/memory_allocation.h>
#include <embb/base/memory_allocation.h>
#include <embb/base/exceptions.h>
#include <embb/base/exceptions.h>
#include <embb/base/thread.h>
#include <embb/tasks/tasks.h>
#include <embb/tasks/tasks.h>
#if TASKS_CPP_AUTOMATIC_INITIALIZE
#if TASKS_CPP_AUTOMATIC_INITIALIZE
#include <embb/base/mutex.h>
#include <embb/base/mutex.h>
...
@@ -237,7 +238,11 @@ void Node::Finalize() {
...
@@ -237,7 +238,11 @@ void Node::Finalize() {
Group
&
Node
::
CreateGroup
()
{
Group
&
Node
::
CreateGroup
()
{
Group
*
group
=
embb
::
base
::
Allocation
::
New
<
Group
>
();
Group
*
group
=
embb
::
base
::
Allocation
::
New
<
Group
>
();
while
(
!
group_lock_
.
TryLock
(
1024
))
{
embb
::
base
::
Thread
::
CurrentYield
();
}
groups_
.
push_back
(
group
);
groups_
.
push_back
(
group
);
group_lock_
.
Unlock
();
return
*
group
;
return
*
group
;
}
}
...
@@ -252,7 +257,11 @@ void Node::DestroyGroup(Group & group) {
...
@@ -252,7 +257,11 @@ void Node::DestroyGroup(Group & group) {
Queue
&
Node
::
CreateQueue
(
mtapi_uint_t
priority
,
bool
ordered
)
{
Queue
&
Node
::
CreateQueue
(
mtapi_uint_t
priority
,
bool
ordered
)
{
Queue
*
queue
=
embb
::
base
::
Allocation
::
New
<
Queue
>
(
priority
,
ordered
);
Queue
*
queue
=
embb
::
base
::
Allocation
::
New
<
Queue
>
(
priority
,
ordered
);
while
(
!
queue_lock_
.
TryLock
(
1024
))
{
embb
::
base
::
Thread
::
CurrentYield
();
}
queues_
.
push_back
(
queue
);
queues_
.
push_back
(
queue
);
queue_lock_
.
Unlock
();
return
*
queue
;
return
*
queue
;
}
}
...
...
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