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
6f87ec95
authored
Nov 05, 2015
by
Christian Kern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace custom spinlock in dataflow with global one.
parent
a002d5af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
67 deletions
+2
-67
dataflow_cpp/include/embb/dataflow/internal/in.h
+2
-2
dataflow_cpp/include/embb/dataflow/internal/spinlock.h
+0
-65
No files found.
dataflow_cpp/include/embb/dataflow/internal/in.h
View file @
6f87ec95
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#if EMBB_DATAFLOW_TRACE_SIGNAL_HISTORY
#if EMBB_DATAFLOW_TRACE_SIGNAL_HISTORY
#include <vector>
#include <vector>
#include <embb/
dataflow/internal/spinlock
.h>
#include <embb/
base/mutex
.h>
#endif
#endif
#include <embb/dataflow/internal/signal.h>
#include <embb/dataflow/internal/signal.h>
...
@@ -80,7 +80,7 @@ class In {
...
@@ -80,7 +80,7 @@ class In {
ClockListener
*
listener_
;
ClockListener
*
listener_
;
bool
connected_
;
bool
connected_
;
#if EMBB_DATAFLOW_TRACE_SIGNAL_HISTORY
#if EMBB_DATAFLOW_TRACE_SIGNAL_HISTORY
SpinL
ock
lock_
;
embb
::
base
::
Spinl
ock
lock_
;
std
::
vector
<
SignalType
>
history_
;
std
::
vector
<
SignalType
>
history_
;
#endif
#endif
...
...
dataflow_cpp/include/embb/dataflow/internal/spinlock.h
deleted
100644 → 0
View file @
a002d5af
/*
* Copyright (c) 2014-2015, Siemens AG. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef EMBB_DATAFLOW_INTERNAL_SPINLOCK_H_
#define EMBB_DATAFLOW_INTERNAL_SPINLOCK_H_
#include <embb/base/atomic.h>
namespace
embb
{
namespace
dataflow
{
namespace
internal
{
class
SpinLock
{
public
:
SpinLock
()
:
lock_
(
0
)
{}
void
Lock
()
{
int
expected
=
0
;
while
(
!
lock_
.
CompareAndSwap
(
expected
,
1
))
{
expected
=
0
;
}
}
bool
TryLock
(
int
spins
=
0
)
{
int
expected
=
0
;
while
(
spins
>
0
&&
!
lock_
.
CompareAndSwap
(
expected
,
1
))
{
expected
=
0
;
spins
--
;
}
return
spins
>
0
;
}
void
Unlock
()
{
lock_
=
0
;
}
private
:
embb
::
base
::
Atomic
<
int
>
lock_
;
};
}
// namespace internal
}
// namespace dataflow
}
// namespace embb
#endif // EMBB_DATAFLOW_INTERNAL_SPINLOCK_H_
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