Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
ITABase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
636bf228
Commit
636bf228
authored
Nov 29, 2016
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving critical section lock, removed warnings.
parent
9f4297e3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
17 deletions
+30
-17
include/ITACriticalSection.h
include/ITACriticalSection.h
+13
-5
src/ITACriticalSection.cpp
src/ITACriticalSection.cpp
+16
-10
tests/SampleBufferTest.cpp
tests/SampleBufferTest.cpp
+1
-2
No files found.
include/ITACriticalSection.h
View file @
636bf228
...
...
@@ -15,7 +15,6 @@
* ----------------------------------------------------------------
*
*/
// $Id: ITACriticalSection.h 2971 2012-11-22 12:10:45Z stienen $
#ifndef INCLUDE_WATCHER_ITA_CRITICALSECTION
#define INCLUDE_WATCHER_ITA_CRITICALSECTION
...
...
@@ -46,7 +45,7 @@ public:
ITACriticalSection
();
//! Kopierkonstruktor
ITACriticalSection
(
const
ITACriticalSection
&
cs
);
ITACriticalSection
(
const
ITACriticalSection
&
cs
);
//! Destruktor
virtual
~
ITACriticalSection
();
...
...
@@ -62,7 +61,7 @@ public:
virtual
void
enter
()
const
;
virtual
void
leave
()
const
;
ITACriticalSection
&
operator
=
(
const
ITACriticalSection
&
rhs
);
ITACriticalSection
&
operator
=
(
const
ITACriticalSection
&
rhs
);
private:
ITACriticalSectionImpl
*
m_pImpl
;
...
...
@@ -73,13 +72,22 @@ class ITA_BASE_API ITACriticalSectionLock
{
public:
//! Konstruktor. Betritt den kritischen Bereich.
ITACriticalSectionLock
(
const
ITACriticalSection
&
cs
)
:
m_cs
(
cs
)
{
m_cs
.
enter
();
}
inline
ITACriticalSectionLock
(
const
ITACriticalSection
&
cs
)
:
m_cs
(
cs
)
{
m_cs
.
enter
();
};
//! Destruktor. Verlässt den kritischen Bereich.
~
ITACriticalSectionLock
()
{
m_cs
.
leave
();
}
~
ITACriticalSectionLock
()
{
m_cs
.
leave
();
};
private:
const
ITACriticalSection
&
m_cs
;
ITACriticalSectionLock
&
operator
=
(
ITACriticalSectionLock
&
);
};
#endif // INCLUDE_WATCHER_ITA_CRITICALSECTION
...
...
src/ITACriticalSection.cpp
View file @
636bf228
// $Id: ITACriticalSection.cpp 2825 2012-07-27 14:26:20Z stienen $
#include "ITACriticalSection.h"
#ifdef WIN32
#include "ITACriticalSectionWin32Impl.h"
ITACriticalSection
::
ITACriticalSection
()
{
ITACriticalSection
::
ITACriticalSection
()
{
m_pImpl
=
new
ITACriticalSectionWin32Impl
;
}
...
...
@@ -14,14 +13,16 @@ ITACriticalSection::ITACriticalSection() {
#include "ITACriticalSectionPosixImpl.h"
ITACriticalSection
::
ITACriticalSection
()
{
ITACriticalSection
::
ITACriticalSection
()
{
m_pImpl
=
new
ITACriticalSectionPosixImpl
;
}
#endif // WIN32 / POSIX
ITACriticalSection
::
ITACriticalSection
(
const
ITACriticalSection
&
cs
)
{
ITACriticalSection
::
ITACriticalSection
(
const
ITACriticalSection
&
)
{
/*
* [fwe 2009-12-15] Bugfix
*
...
...
@@ -36,24 +37,29 @@ ITACriticalSection::ITACriticalSection(const ITACriticalSection& cs) {
*/
}
ITACriticalSection
::~
ITACriticalSection
()
{
ITACriticalSection
::~
ITACriticalSection
()
{
delete
m_pImpl
;
}
bool
ITACriticalSection
::
tryenter
()
const
{
bool
ITACriticalSection
::
tryenter
()
const
{
// Delegieren
return
m_pImpl
->
tryenter
();
}
void
ITACriticalSection
::
enter
()
const
{
void
ITACriticalSection
::
enter
()
const
{
m_pImpl
->
enter
();
}
void
ITACriticalSection
::
leave
()
const
{
void
ITACriticalSection
::
leave
()
const
{
m_pImpl
->
leave
();
}
ITACriticalSection
&
ITACriticalSection
::
operator
=
(
const
ITACriticalSection
&
rhs
)
{
ITACriticalSection
&
ITACriticalSection
::
operator
=
(
const
ITACriticalSection
&
)
{
/*
* Mann kann Critical sections nicht zuweisen, denn sie haben keinen wert.
* Wohl aber eine definierte Identität der erhalten bleiben muss.
...
...
tests/SampleBufferTest.cpp
View file @
636bf228
...
...
@@ -26,10 +26,9 @@
using
namespace
std
;
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
,
char
**
)
{
ITASampleBuffer
sb
;
return
0
;
}
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