Skip to content

Conversation

revaultch
Copy link
Contributor

The issue is sort o the same as here: #47
Assertion error, when destroing ctx while creating a socket from a different thread: ./src/mutex.hpp:123
Test program:
clang++ -std=c++1y -stdlib=libc++ test.cc libzmq/src/.libs/libzmq.a -I cppzmq -I libzmq/include -o unfixed && ./unfixed
Tested with 4-1 HEAD

#include <thread>
#include <iostream>
#include <memory>
#include "zmq.hpp"

int main() {
  for (int i=0; i< 100000; i++) {
    if (i%10==0)
      std::cout << "iteration " << i << std::endl;
    auto ctx = std::make_shared<zmq::context_t>();

    std::thread contextcloser([ctx] {
        ctx->close();
      });
    std::thread socketopener([ctx] {
        zmq::socket_t s(*ctx, ZMQ_DEALER);
      });
    socketopener.join();
    contextcloser.join();
  }
}

c-rack added a commit that referenced this pull request Nov 10, 2015
Fixes assertion error: src/mutex.hpp:123
@c-rack c-rack merged commit fadb37e into zeromq:master Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants