Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Reinecke
ducc
Commits
8d98e3eb
Commit
8d98e3eb
authored
Sep 03, 2020
by
Martin Reinecke
Browse files
Merge branch 'ducc0' into new_data_structure
parents
82f69370
82659582
Pipeline
#81518
passed with stages
in 12 minutes and 51 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/ducc0/infra/threading.cc
View file @
8d98e3eb
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <queue>
#include <queue>
#include <atomic>
#include <atomic>
#include <vector>
#include <vector>
#include <exception>
#if __has_include(<pthread.h>)
#if __has_include(<pthread.h>)
#include <pthread.h>
#include <pthread.h>
#endif
#endif
...
@@ -110,11 +111,12 @@ template <typename T> class concurrent_queue
...
@@ -110,11 +111,12 @@ template <typename T> class concurrent_queue
class
thread_pool
class
thread_pool
{
{
private:
private:
#if __cpp_lib_hardware_interference_size >= 201603
//FIXME: temporary ... OSX seems to set the macro, but not to have the variable
struct
alignas
(
std
::
hardware_destructive_interference_size
)
worker
//#if __cpp_lib_hardware_interference_size >= 201603
#else
// struct alignas(std::hardware_destructive_interference_size) worker
//#else
struct
alignas
(
64
)
worker
struct
alignas
(
64
)
worker
#endif
//
#endif
{
{
std
::
thread
thread
;
std
::
thread
thread
;
std
::
condition_variable
work_ready
;
std
::
condition_variable
work_ready
;
...
@@ -400,7 +402,7 @@ void Distribution::thread_map(std::function<void(Scheduler &)> f)
...
@@ -400,7 +402,7 @@ void Distribution::thread_map(std::function<void(Scheduler &)> f)
}
}
counter
.
wait
();
counter
.
wait
();
if
(
ex
)
if
(
ex
)
rethrow_exception
(
ex
);
std
::
rethrow_exception
(
ex
);
}
}
void
execSingle
(
size_t
nwork
,
std
::
function
<
void
(
Scheduler
&
)
>
func
)
void
execSingle
(
size_t
nwork
,
std
::
function
<
void
(
Scheduler
&
)
>
func
)
...
...
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