Problem: race conditions for options.linger (#2910)

* Problem: race conditions for options.linger

Solution: make options.linger atomic
This commit is contained in:
Simon Giesecke
2018-02-08 23:10:45 +01:00
committed by Luca Boccassi
parent de0c669323
commit a1d55d0506
7 changed files with 178 additions and 88 deletions

View File

@@ -205,7 +205,7 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_,
{
options.socket_id = sid_;
options.ipv6 = (parent_->get (ZMQ_IPV6) != 0);
options.linger = parent_->get (ZMQ_BLOCKY) ? -1 : 0;
options.linger.store (parent_->get (ZMQ_BLOCKY) ? -1 : 0);
if (thread_safe) {
mailbox = new (std::nothrow) mailbox_safe_t (&sync);