Created
August 20, 2010 16:50
-
-
Save hintjens/540685 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Provoke assertion failure in sub.cpp:45 | |
// | |
#include <zmq.h> | |
int main () { | |
void *context; // ØMQ context for our process | |
context = zmq_init (1); | |
void *s2; | |
s2 = zmq_socket (context, ZMQ_SUB); | |
zmq_setsockopt (s2, ZMQ_SUBSCRIBE, "", 0); | |
zmq_bind (s2, "inproc://socket"); | |
void *s1; | |
s1 = zmq_socket (context, ZMQ_SUB); | |
zmq_setsockopt (s1, ZMQ_SUBSCRIBE, "", 0); | |
zmq_connect (s1, "inproc://socket"); | |
zmq_msg_t message; | |
zmq_msg_init (&message); | |
// Asserts on receive from s1 or s2 | |
zmq_recv (s1, &message, 0); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Provoke assertion failure in pull.cpp:39 | |
// | |
#include <zmq.h> | |
int main () { | |
void *context; // ØMQ context for our process | |
context = zmq_init (1); | |
void *s2; | |
s2 = zmq_socket (context, ZMQ_PULL); | |
zmq_bind (s2, "inproc://socket"); | |
void *s1; | |
s1 = zmq_socket (context, ZMQ_PULL); | |
zmq_connect (s1, "inproc://socket"); | |
zmq_msg_t message; | |
zmq_msg_init (&message); | |
// Asserts on receive from s1 or s2 | |
zmq_recv (s1, &message, 0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment