本文整理汇总了C++中zpoller_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ zpoller_destroy函数的具体用法?C++ zpoller_destroy怎么用?C++ zpoller_destroy使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zpoller_destroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: devio_destroy
/* Destroy an instance of the Device Information */
devio_err_e devio_destroy (devio_t **self_p)
{
assert (self_p);
if (*self_p) {
devio_t *self = *self_p;
/* Destroy children threads before proceeding */
_devio_destroy_smio_all (self);
/* Starting destructing by the last resource */
/* Notice that we destroy the worker first, as to
* unregister from broker as soon as possible to avoid
* loosing requests from clients */
zctx_destroy (&self->ctx);
disp_table_destroy (&self->disp_table_thsafe_ops);
zhash_destroy (&self->sm_io_h);
self->thsafe_server_ops = NULL;
llio_release (self->llio, NULL);
llio_destroy (&self->llio);
free (self->endpoint_broker);
free (self->name);
zpoller_destroy (&self->poller);
free (self->pipes);
free (self);
*self_p = NULL;
}
return DEVIO_SUCCESS;
}
示例2: s_agent_task
static void
s_agent_task (void *args, zctx_t *ctx, void *pipe)
{
char *endpoint = zstr_recv (pipe);
assert (endpoint);
agent_t *self = s_agent_new (ctx, pipe, endpoint);
zpoller_t *poller = zpoller_new (self->pipe, self->socket, NULL);
while (!zctx_interrupted) {
// Poll on API pipe and on monitor socket
void *result = zpoller_wait (poller, -1);
if (result == NULL)
break; // Interrupted
else
if (result == self->pipe)
s_api_command (self);
else
if (result == self->socket)
s_socket_event (self);
if (self->terminated)
break;
}
zpoller_destroy (&poller);
s_agent_destroy (&self);
}
示例3: drops_agent_main
void
drops_agent_main (void *args, zctx_t *ctx, void *pipe)
{
// Create agent instance to pass around
s_agent_t *self = s_agent_new (ctx, pipe);
if (!self) // Interrupted
return;
zstr_send (self->pipe, "OK");
// These are the sockets we will monitor for activity
zpoller_t *poller = zpoller_new (
self->pipe, zyre_socket (self->zyre), NULL);
while (!zpoller_terminated (poller)) {
// Check directory once a second; this is a pretty nasty way of
// doing it, but portable and simple. Later I'd like to use file
// system monitoring library and get events back over a socket.
void *which = zpoller_wait (poller, 1000);
if (which == self->pipe)
s_recv_from_api (self);
else
if (which == zyre_socket (self->zyre))
s_recv_from_zyre (self);
if (self->terminated)
break;
s_check_directory (self);
}
zpoller_destroy (&poller);
s_agent_destroy (&self);
}
示例4: zpoller_remove
MessageProcessor::~MessageProcessor()
{
zpoller_remove(zmqPoller_, zmqSocket_);
zpoller_destroy(&zmqPoller_);
zactor_destroy(&zmqAuth_);
zsock_destroy(&zmqSocket_);
}
示例5: s_can_connect
static bool
s_can_connect (void *server, void *client)
{
// We'll do each test on a new port number since otherwise we have to
// destroy and recreate the sockets each time.
static int port_nbr = 9000;
int rc = zsocket_bind (server, "tcp://*:%d", port_nbr);
assert (rc == port_nbr);
rc = zsocket_connect (client, "tcp://localhost:%d", port_nbr);
assert (rc == 0);
zpoller_t *poller = zpoller_new (client, NULL);
zstr_send (server, "Hello, World");
// Need up to half a second if running under Valgrind
bool success = zpoller_wait (poller, 500) == client;
if (success)
free (zstr_recv (client));
zpoller_destroy (&poller);
rc = zsocket_unbind (server, "tcp://*:%d", port_nbr);
assert (rc != -1);
rc = zsocket_disconnect (client, "tcp://localhost:%d", port_nbr);
assert (rc != -1);
port_nbr++;
return success;
}
示例6: s_can_connect
// Checks whether client can connect to server
static bool
s_can_connect (zctx_t *ctx, void **server, void **client)
{
int port_nbr = zsocket_bind (*server, "tcp://127.0.0.1:*");
assert (port_nbr > 0);
int rc = zsocket_connect (*client, "tcp://127.0.0.1:%d", port_nbr);
assert (rc == 0);
// Give the connection time to fail if that's the plan
zclock_sleep (200);
// By default PUSH sockets block if there's no peer
zsock_set_sndtimeo (*server, 200);
zstr_send (*server, "Hello, World");
zpoller_t *poller = zpoller_new (*client, NULL);
bool success = (zpoller_wait (poller, 400) == *client);
zpoller_destroy (&poller);
zsocket_destroy (ctx, *client);
zsocket_destroy (ctx, *server);
*server = zsocket_new (ctx, ZMQ_PUSH);
assert (*server);
*client = zsocket_new (ctx, ZMQ_PULL);
assert (*client);
return success;
}
示例7: zhttp_client_wait
int
zhttp_client_wait (zhttp_client_t *self, int timeout) {
zpoller_t *poller = zpoller_new (self, NULL);
void* sock = zpoller_wait (poller, timeout);
if (sock) {
zpoller_destroy (&poller);
return 0;
}
if (zpoller_expired (poller))
errno = EAGAIN;
else
errno = ETERM;
zpoller_destroy (&poller);
return -1;
}
示例8: s_stream_engine_destroy
static void
s_stream_engine_destroy (stream_engine_t **self_p)
{
assert (self_p);
if (*self_p) {
stream_engine_t *self = *self_p;
zpoller_destroy (&self->poller);
zlistx_destroy (&self->selectors);
zsock_destroy (&self->msgpipe);
free (self);
*self_p = NULL;
}
}
示例9: s_self_destroy
static void
s_self_destroy (self_t **self_p)
{
assert (self_p);
if (*self_p) {
self_t *self = *self_p;
zsock_destroy (&self->frontend);
zsock_destroy (&self->backend);
zsock_destroy (&self->capture);
zpoller_destroy (&self->poller);
free (self);
*self_p = NULL;
}
}
示例10: s_self_destroy
static void
s_self_destroy (self_t **self_p)
{
assert (self_p);
if (*self_p) {
self_t *self = *self_p;
zpoller_destroy (&self->poller);
zframe_destroy (&self->transmit);
zframe_destroy (&self->filter);
zsys_udp_close (self->udpsock);
free (self);
*self_p = NULL;
}
}
示例11: s_upstream_destroy
static void
s_upstream_destroy (upstream_t **self_p)
{
assert (self_p);
if (*self_p) {
upstream_t *self = *self_p;
zpoller_destroy (&self->poller);
zsock_destroy (&self->push);
// Free object itself
free (self);
*self_p = NULL;
}
}
示例12: s_alerts
static void
s_alerts (
zsock_t *pipe,
void *args) {
const char *name = "ALERT";
mlm_client_t *cl = mlm_client_new ();
mlm_client_connect (cl, endpoint, 5000, __PRETTY_FUNCTION__);
mlm_client_set_producer (cl, stream);
zsock_t *msgpipe = mlm_client_msgpipe (cl);
zpoller_t *poller = zpoller_new (pipe, msgpipe, NULL);
char *alert_state = strdup ("NEW");
zsock_signal (pipe, 0);
while (!zsys_interrupted) {
zsock_t *which = zpoller_wait (poller, 1000);
if (!which) {
mlm_client_sendx (cl, "alert://[email protected]", alert_state, NULL);
continue;
}
if (which == pipe)
break;
//which == msgpipe
zmsg_t *msg = mlm_client_recv (cl);
if (!streq (mlm_client_command (cl), "MAILBOX DELIVER"))
goto msg_destroy;
char *alert_name = zmsg_popstr (msg);
zstr_free (&alert_state);
alert_state = zmsg_popstr (msg);
zsys_info ("%s: Alert '%s' new state is '%s'", name, alert_name, alert_state);
zstr_free (&alert_name);
msg_destroy:
zmsg_destroy (&msg);
}
zstr_free (&alert_state);
zpoller_destroy (&poller);
mlm_client_destroy (&cl);
}
示例13: someactor_destroy
static void
someactor_destroy (someactor_t **self_p)
{
assert (self_p);
if (*self_p) {
someactor_t *self = *self_p;
// TODO: Free actor properties
// Free object itself
zpoller_destroy (&self->poller);
free (self);
*self_p = NULL;
}
}
示例14: s_self_destroy
static void
s_self_destroy (self_t **self_p)
{
assert (self_p);
if (*self_p) {
self_t *self = *self_p;
#if defined (ZMQ_EVENT_ALL)
zmq_socket_monitor (self->monitored, NULL, 0);
#endif
zpoller_destroy (&self->poller);
zsock_destroy (&self->sink);
free (self);
*self_p = NULL;
}
}
示例15: s_self_destroy
static void
s_self_destroy (self_t **self_p)
{
assert (self_p);
if (*self_p) {
self_t *self = *self_p;
zhash_destroy (&self->passwords);
zhash_destroy (&self->whitelist);
zhash_destroy (&self->blacklist);
zcertstore_destroy (&self->certstore);
zsock_destroy (&self->handler);
zpoller_destroy (&self->poller);
free (self);
*self_p = NULL;
}
}