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
54508d87
authored
Feb 24, 2016
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base_cpp: added exceptions when errors dependent on user input occur
parent
6a0eb53f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
base_cpp/src/mutex.cc
+12
-3
No files found.
base_cpp/src/mutex.cc
View file @
54508d87
...
...
@@ -32,7 +32,10 @@ namespace base {
namespace
internal
{
MutexBase
::
MutexBase
(
int
mutex_type
)
:
mutex_
()
{
embb_mutex_init
(
&
mutex_
,
mutex_type
);
int
result
=
embb_mutex_init
(
&
mutex_
,
mutex_type
);
if
(
EMBB_SUCCESS
!=
result
)
{
EMBB_THROW
(
ErrorException
,
"Could not initialize mutex."
);
}
}
MutexBase
::~
MutexBase
()
{
...
...
@@ -40,7 +43,10 @@ MutexBase::~MutexBase() {
}
void
MutexBase
::
Lock
()
{
embb_mutex_lock
(
&
mutex_
);
int
result
=
embb_mutex_lock
(
&
mutex_
);
if
(
EMBB_SUCCESS
!=
result
)
{
EMBB_THROW
(
ErrorException
,
"Could not lock mutex."
);
}
}
bool
MutexBase
::
TryLock
()
{
...
...
@@ -49,7 +55,10 @@ bool MutexBase::TryLock() {
}
void
MutexBase
::
Unlock
()
{
embb_mutex_unlock
(
&
mutex_
);
int
result
=
embb_mutex_unlock
(
&
mutex_
);
if
(
EMBB_SUCCESS
!=
result
)
{
EMBB_THROW
(
ErrorException
,
"Could not unlock mutex."
);
}
}
}
// namespace internal
...
...
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