A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Linux and FreeBSD don't agree on the type name, bummers
[simgrid.git]
/
src
/
include
/
xbt
/
parmap.hpp
diff --git
a/src/include/xbt/parmap.hpp
b/src/include/xbt/parmap.hpp
index
e28e78a
..
b82c126
100644
(file)
--- a/
src/include/xbt/parmap.hpp
+++ b/
src/include/xbt/parmap.hpp
@@
-22,6
+22,10
@@
#include <sys/syscall.h>
#endif
#include <sys/syscall.h>
#endif
+#if HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+
XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap);
namespace simgrid {
XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap);
namespace simgrid {
@@
-172,11
+176,17
@@
template <typename T> Parmap<T>::Parmap(unsigned num_workers, e_xbt_parmap_mode_
/* Bind the worker to a core if possible */
#if HAVE_PTHREAD_SETAFFINITY
/* Bind the worker to a core if possible */
#if HAVE_PTHREAD_SETAFFINITY
- pthread_t pthread = this->workers[i]->native_handle();
+#if HAVE_PTHREAD_NP_H /* FreeBSD ? */
+ cpuset_t cpuset;
+ size_t size = sizeof(cpuset_t);
+#else /* Linux ? */
cpu_set_t cpuset;
cpu_set_t cpuset;
+ size_t size = sizeof(cpu_set_t);
+#endif
+ pthread_t pthread = this->workers[i]->native_handle();
CPU_ZERO(&cpuset);
CPU_SET(core_bind, &cpuset);
CPU_ZERO(&cpuset);
CPU_SET(core_bind, &cpuset);
- pthread_setaffinity_np(pthread, size
of(cpu_set_t)
, &cpuset);
+ pthread_setaffinity_np(pthread, size, &cpuset);
if (core_bind != std::thread::hardware_concurrency() - 1)
core_bind++;
else
if (core_bind != std::thread::hardware_concurrency() - 1)
core_bind++;
else