Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
3503fdad
Commit
3503fdad
authored
Jan 12, 2015
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1299 from rodgert/master
Align inter-thread shared structures on cache-line granularity
parents
c816e422
6372fc2e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
configure.ac
configure.ac
+1
-1
command.hpp
src/command.hpp
+4
-0
yqueue.hpp
src/yqueue.hpp
+15
-1
No files found.
configure.ac
View file @
3503fdad
...
...
@@ -481,7 +481,7 @@ AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
# Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(perror gettimeofday clock_gettime memset socket getifaddrs freeifaddrs fork)
AC_CHECK_FUNCS(perror gettimeofday clock_gettime memset socket getifaddrs freeifaddrs fork
posix_memalign
)
AC_CHECK_HEADERS([alloca.h])
LIBZMQ_CHECK_SOCK_CLOEXEC([
...
...
src/command.hpp
View file @
3503fdad
...
...
@@ -146,6 +146,10 @@ namespace zmq
}
done
;
}
args
;
enum
{
pad_size
=
64
-
(
sizeof
(
destination
)
+
sizeof
(
args
))
};
unsigned
char
unused
[
pad_size
];
};
}
...
...
src/yqueue.hpp
View file @
3503fdad
...
...
@@ -41,8 +41,16 @@ namespace zmq
// T is the type of the object in the queue.
// N is granularity of the queue (how many pushes have to be done till
// actual memory allocation is required).
#ifdef HAVE_POSIX_MEMALIGN
// ALIGN is the memory alignment size to use in the case where we have
// posix_memalign available. Default value is 64, this alignment will
// prevent two queue chunks from occupying the same CPU cache line on
// architectures where cache lines are <= 64 bytes (e.g. most things
// except POWER).
template
<
typename
T
,
int
N
,
size_t
ALIGN
=
64
>
class
yqueue_t
#else
template
<
typename
T
,
int
N
>
class
yqueue_t
#endif
{
public
:
...
...
@@ -103,7 +111,13 @@ namespace zmq
end_chunk
->
next
=
sc
;
sc
->
prev
=
end_chunk
;
}
else
{
#ifdef HAVE_POSIX_MEMALIGN
void
*
pv
;
if
(
posix_memalign
(
&
pv
,
ALIGN
,
sizeof
(
chunk_t
))
==
0
)
end_chunk
->
next
=
(
chunk_t
*
)
pv
;
#else
end_chunk
->
next
=
(
chunk_t
*
)
malloc
(
sizeof
(
chunk_t
));
#endif
alloc_assert
(
end_chunk
->
next
);
end_chunk
->
next
->
prev
=
end_chunk
;
}
...
...
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