MCPcopy Create free account
hub / github.com/catboost/catboost / copy

Method copy

contrib/libs/zeromq/src/msg.cpp:326–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326int zmq::msg_t::copy (msg_t &src_)
327{
328 // Check the validity of the source.
329 if (unlikely (!src_.check ())) {
330 errno = EFAULT;
331 return -1;
332 }
333
334 const int rc = close ();
335 if (unlikely (rc < 0))
336 return rc;
337
338 // The initial reference count, when a non-shared message is initially
339 // shared (between the original and the copy we create here).
340 const atomic_counter_t::integer_t initial_shared_refcnt = 2;
341
342 if (src_.is_lmsg () || src_.is_zcmsg ()) {
343 // One reference is added to shared messages. Non-shared messages
344 // are turned into shared messages.
345 if (src_.flags () & msg_t::shared)
346 src_.refcnt ()->add (1);
347 else {
348 src_.set_flags (msg_t::shared);
349 src_.refcnt ()->set (initial_shared_refcnt);
350 }
351 }
352
353 if (src_._u.base.metadata != NULL)
354 src_._u.base.metadata->add_ref ();
355
356 if (src_._u.base.group.type == group_type_long)
357 src_._u.base.group.lgroup.content->refcnt.add (1);
358
359 *this = src_;
360
361 return 0;
362}
363
364void *zmq::msg_t::data ()
365{

Callers 4

run_ruffFunction · 0.45
xattach_pipeMethod · 0.45
zmq_msg_copyFunction · 0.45
captureFunction · 0.45

Calls 10

is_lmsgMethod · 0.80
is_zcmsgMethod · 0.80
refcntMethod · 0.80
set_flagsMethod · 0.80
closeFunction · 0.50
checkMethod · 0.45
flagsMethod · 0.45
addMethod · 0.45
setMethod · 0.45
add_refMethod · 0.45

Tested by

no test coverage detected