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
987eb6dd
Commit
987eb6dd
authored
Dec 17, 2015
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1671 from brian-peloton/master
Fix alignment of initial chunk in yqueue
parents
768fc769
700b91d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
yqueue.hpp
src/yqueue.hpp
+14
-8
No files found.
src/yqueue.hpp
View file @
987eb6dd
...
...
@@ -67,7 +67,7 @@ namespace zmq
// Create the queue.
inline
yqueue_t
()
{
begin_chunk
=
(
chunk_t
*
)
malloc
(
sizeof
(
chunk_t
)
);
begin_chunk
=
allocate_chunk
(
);
alloc_assert
(
begin_chunk
);
begin_pos
=
0
;
back_chunk
=
NULL
;
...
...
@@ -121,13 +121,7 @@ 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
end_chunk
->
next
=
allocate_chunk
();
alloc_assert
(
end_chunk
->
next
);
end_chunk
->
next
->
prev
=
end_chunk
;
}
...
...
@@ -193,6 +187,18 @@ namespace zmq
chunk_t
*
next
;
};
inline
chunk_t
*
allocate_chunk
()
{
#ifdef HAVE_POSIX_MEMALIGN
void
*
pv
;
if
(
posix_memalign
(
&
pv
,
ALIGN
,
sizeof
(
chunk_t
))
==
0
)
return
(
chunk_t
*
)
pv
;
return
NULL
;
#else
return
(
chunk_t
*
)
malloc
(
sizeof
(
chunk_t
));
#endif
}
// Back position may point to invalid memory if the queue is empty,
// while begin & end positions are always valid. Begin position is
// accessed exclusively be queue reader (front/pop), while back and
...
...
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