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
708353a1
Commit
708353a1
authored
Jul 22, 2015
by
KIU Shueng Chuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advance refcnt only if it was used
parent
c05a475b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
decoder_allocators.hpp
src/decoder_allocators.hpp
+7
-2
raw_decoder.cpp
src/raw_decoder.cpp
+2
-1
v2_decoder.cpp
src/v2_decoder.cpp
+2
-1
No files found.
src/decoder_allocators.hpp
View file @
708353a1
...
...
@@ -132,9 +132,14 @@ namespace zmq
bufsize
=
new_size
;
}
zmq
::
atomic_counter_t
*
creat
e_refcnt
()
zmq
::
atomic_counter_t
*
provid
e_refcnt
()
{
return
msg_refcnt
++
;
return
msg_refcnt
;
}
void
advance_refcnt
()
{
msg_refcnt
++
;
}
private
:
...
...
src/raw_decoder.cpp
View file @
708353a1
...
...
@@ -63,11 +63,12 @@ int zmq::raw_decoder_t::decode (const uint8_t *data_, size_t size_,
int
rc
=
in_progress
.
init
((
unsigned
char
*
)
data_
,
size_
,
shared_message_memory_allocator
::
call_dec_ref
,
allocator
.
buffer
(),
allocator
.
creat
e_refcnt
()
);
allocator
.
provid
e_refcnt
()
);
// if the buffer serves as memory for a zero-copy message, release it
// and allocate a new buffer in get_buffer for the next decode
if
(
in_progress
.
is_zcmsg
())
{
allocator
.
advance_refcnt
();
allocator
.
release
();
}
...
...
src/v2_decoder.cpp
View file @
708353a1
...
...
@@ -129,11 +129,12 @@ int zmq::v2_decoder_t::size_ready(uint64_t msg_size, unsigned char const* read_p
// if the message will be a large message, pass a valid refcnt memory location as well
rc
=
in_progress
.
init
(
(
unsigned
char
*
)
read_pos
,
msg_size
,
shared_message_memory_allocator
::
call_dec_ref
,
buffer
(),
creat
e_refcnt
()
);
provid
e_refcnt
()
);
// For small messages, data has been copied and refcount does not have to be increased
if
(
in_progress
.
is_zcmsg
())
{
advance_refcnt
();
inc_ref
();
}
}
...
...
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