Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
4004c765
Verified
Commit
4004c765
authored
3 years ago
by
Tobias Frisch
Browse files
Options
Downloads
Patches
Plain Diff
Fixed events by using mutex for older GCC as alternative to semaphores
Signed-off-by:
Tobias Frisch
<
tfrisch@uni-koblenz.de
>
parent
a874aabb
No related branches found
No related tags found
No related merge requests found
Pipeline
#27491
passed
3 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+2
-2
2 additions, 2 deletions
CMakeLists.txt
include/vkcv/Event.hpp
+25
-1
25 additions, 1 deletion
include/vkcv/Event.hpp
with
27 additions
and
3 deletions
CMakeLists.txt
+
2
−
2
View file @
4004c765
...
...
@@ -42,8 +42,8 @@ if (vkcv_build_debug)
endif
()
endif
()
if
((
CMAKE_CXX_COMPILER_ID STREQUAL
"GNU"
)
AND
(
CMAKE_CXX_COMPILER_VERSION VERSION_LESS
"1
0
.0.0"
))
set
(
vkcv_flags
${
vkcv_flags
}
" -std=c++2a -std=gnu++2a"
)
if
((
CMAKE_CXX_COMPILER_ID STREQUAL
"GNU"
)
AND
(
CMAKE_CXX_COMPILER_VERSION VERSION_LESS
"1
1
.0.0"
))
list
(
APPEND vkcv_definitions __NO_SEMAPHORES__
)
endif
()
# configure everything to use the required dependencies
...
...
This diff is collapsed.
Click to expand it.
include/vkcv/Event.hpp
+
25
−
1
View file @
4004c765
...
...
@@ -3,8 +3,12 @@
#include
<functional>
#ifndef __MINGW32__
#ifdef __NO_SEMAPHORES__
#include
<mutex>
#else
#include
<semaphore>
#endif
#endif
#include
<vector>
...
...
@@ -34,7 +38,11 @@ namespace vkcv {
uint32_t
m_id_counter
;
#ifndef __MINGW32__
#ifdef __NO_SEMAPHORES__
std
::
mutex
m_mutex
;
#else
std
::
binary_semaphore
m_semaphore
;
#endif
#endif
public:
...
...
@@ -84,7 +92,11 @@ namespace vkcv {
*/
void
lock
()
{
#ifndef __MINGW32__
#ifdef __NO_SEMAPHORES__
m_mutex
.
lock
();
#else
m_semaphore
.
acquire
();
#endif
#endif
}
...
...
@@ -93,15 +105,27 @@ namespace vkcv {
*/
void
unlock
()
{
#ifndef __MINGW32__
#ifdef __NO_SEMAPHORES__
m_mutex
.
unlock
();
#else
m_semaphore
.
release
();
#endif
#endif
}
explicit
event
(
bool
locked
=
false
)
#ifndef __MINGW32__
#ifndef __NO_SEMAPHORES__
:
m_semaphore
(
locked
?
1
:
0
)
#endif
{}
#endif
{
#ifndef __MINGW32__
#ifdef __NO_SEMAPHORES__
if
(
locked
)
m_mutex
.
lock
();
#endif
#endif
}
event
(
const
event
&
other
)
=
delete
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment