Go to the documentation of this file.
3 #include "../include/zmq.h"
9 #include "platform.hpp"
11 #if defined ZMQ_HAVE_WINDOWS
21 #if defined ZMQ_HAVE_WINDOWS
22 static unsigned int __stdcall
worker (
void *ctx_)
50 #if defined ZMQ_MAKE_VALGRIND_HAPPY
72 #if defined ZMQ_HAVE_WINDOWS
79 int main (
int argc,
char *argv[])
81 #if defined ZMQ_HAVE_WINDOWS
84 pthread_t local_thread;
92 unsigned long elapsed;
93 unsigned long throughput;
97 printf (
"usage: inproc_thr <message-size> <message-count>\n");
122 #if defined ZMQ_HAVE_WINDOWS
124 if (local_thread == 0) {
125 printf (
"error in _beginthreadex\n");
129 rc = pthread_create (&local_thread,
NULL,
worker, ctx);
131 printf (
"error in pthread_create: %s\n",
zmq_strerror (rc));
151 printf (
"message of incorrect size received\n");
164 printf (
"message of incorrect size received\n");
179 #if defined ZMQ_HAVE_WINDOWS
180 DWORD rc2 = WaitForSingleObject (local_thread, INFINITE);
181 if (rc2 == WAIT_FAILED) {
182 printf (
"error in WaitForSingleObject\n");
185 BOOL rc3 = CloseHandle (local_thread);
187 printf (
"error in CloseHandle\n");
191 rc = pthread_join (local_thread,
NULL);
193 printf (
"error in pthread_join: %s\n",
zmq_strerror (rc));
212 megabits = (double) (throughput *
message_size * 8) / 1000000;
214 printf (
"mean throughput: %d [msg/s]\n", (
int) throughput);
215 printf (
"mean throughput: %.3f [Mb/s]\n", (
double) megabits);
const ZMQ_EXPORT char * zmq_strerror(int errnum_)
static size_t message_size
ZMQ_EXPORT int zmq_sendmsg(void *s_, zmq_msg_t *msg_, int flags_)
static void * worker(void *ctx_)
ZMQ_EXPORT void * zmq_msg_data(zmq_msg_t *msg_)
ZMQ_EXPORT int zmq_connect(void *s_, const char *addr_)
ZMQ_EXPORT size_t zmq_msg_size(const zmq_msg_t *msg_)
ZMQ_EXPORT void * zmq_stopwatch_start(void)
ZMQ_EXPORT int zmq_bind(void *s_, const char *addr_)
ZMQ_EXPORT void * zmq_socket(void *, int type_)
int main(int argc, char *argv[])
ZMQ_EXPORT int zmq_msg_init(zmq_msg_t *msg_)
ZMQ_EXPORT int zmq_close(void *s_)
ZMQ_EXPORT int zmq_recvmsg(void *s_, zmq_msg_t *msg_, int flags_)
ZMQ_EXPORT int zmq_msg_init_size(zmq_msg_t *msg_, size_t size_)
ZMQ_EXPORT void * zmq_init(int io_threads_)
ZMQ_EXPORT int zmq_ctx_term(void *context_)
ZMQ_EXPORT int zmq_msg_close(zmq_msg_t *msg_)
ZMQ_EXPORT unsigned long zmq_stopwatch_stop(void *watch_)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:54