当前位置: 首页>>代码示例>>C++>>正文


C++ zpoller_destroy函数代码示例

本文整理汇总了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;
}
开发者ID:julianofjm,项目名称:bpm-software,代码行数:31,代码来源:dev_io_core.c

示例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);
}
开发者ID:sirithink,项目名称:czmq,代码行数:27,代码来源:zmonitor.c

示例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);
}
开发者ID:edgenet,项目名称:drops,代码行数:32,代码来源:drops_agent.c

示例4: zpoller_remove

MessageProcessor::~MessageProcessor()
{
    zpoller_remove(zmqPoller_, zmqSocket_);
    zpoller_destroy(&zmqPoller_);
    zactor_destroy(&zmqAuth_);
    zsock_destroy(&zmqSocket_);
}
开发者ID:yamamushi,项目名称:opentxs,代码行数:7,代码来源:MessageProcessor.cpp

示例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;
}
开发者ID:AndreasBomholtz,项目名称:czmq,代码行数:25,代码来源:zauth.c

示例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;
}
开发者ID:AxelVoitier,项目名称:czmq,代码行数:26,代码来源:zauth_v2.c

示例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;
}
开发者ID:sphaero,项目名称:czmq,代码行数:19,代码来源:zhttp_client.c

示例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;
    }
}
开发者ID:hurtonm,项目名称:malamute,代码行数:13,代码来源:mlm_stream_simple.c

示例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;
    }
}
开发者ID:claws,项目名称:czmq,代码行数:14,代码来源:zproxy.c

示例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;
    }
}
开发者ID:Q-Leap-Networks,项目名称:czmq,代码行数:14,代码来源:zbeacon.c

示例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;
    }
}
开发者ID:taotetek,项目名称:pressure,代码行数:14,代码来源:upstream.c

示例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);
}
开发者ID:miska,项目名称:mallory,代码行数:49,代码来源:alerts.c

示例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;
    }
}
开发者ID:emef,项目名称:dblocks-core,代码行数:15,代码来源:someactor.c

示例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;
    }
}
开发者ID:AxelVoitier,项目名称:czmq,代码行数:15,代码来源:zmonitor.c

示例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;
    }
}
开发者ID:hisitepu,项目名称:czmq,代码行数:16,代码来源:zauth.c


注:本文中的zpoller_destroy函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。