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


C++ zlist_first函数代码示例

本文整理汇总了C++中zlist_first函数的典型用法代码示例。如果您正苦于以下问题:C++ zlist_first函数的具体用法?C++ zlist_first怎么用?C++ zlist_first使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zlist_first函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: zmsg_last

zframe_t *
zmsg_last (zmsg_t *self)
{
    assert (self);
    zframe_t *frame = (zframe_t *) zlist_first (self->frames);
    while (frame) {
        zframe_t *next = (zframe_t *) zlist_next (self->frames);
        if (!next)
            break;
        frame = next;
    }
    return frame;
}
开发者ID:bartuer,项目名称:bew,代码行数:13,代码来源:zmsg.c

示例2: s_timer_remove

static void
s_timer_remove (zloop_t *self, int timer_id)
{
    s_timer_t *timer = (s_timer_t *) zlist_first (self->timers);
    while (timer) {
        if (timer->timer_id == timer_id) {
            zlist_remove (self->timers, timer);
            free (timer);
            break;
        }
        timer = (s_timer_t *) zlist_next (self->timers);
    }
}
开发者ID:ekapke,项目名称:czmq,代码行数:13,代码来源:zloop.c

示例3: zsync_node_peers_lookup

static zsync_peer_t *
zsync_node_peers_lookup (zsync_node_t *self, char *uuid)
{
    assert (self);
    zsync_peer_t *peer = zlist_first (self->peers);
    while (peer) {
        if (streq (zsync_peer_uuid (peer), uuid)) {
            return peer;
        }
        peer = zlist_next (self->peers);
    }
    return NULL;
}
开发者ID:skyformat99,项目名称:protocol,代码行数:13,代码来源:zsync_node.c

示例4: invoke_cbs

static int invoke_cbs (flux_t *h, int64_t j, json_object *jcb, int errnum)
{
    int rc = 0;
    cb_pair_t *c = NULL;
    jscctx_t *ctx = getctx (h);
    for (c = zlist_first (ctx->callbacks); c; c = zlist_next (ctx->callbacks)) {
        if (c->cb (jcb, c->arg, errnum) < 0) {
            flux_log (h, LOG_ERR, "callback returns an error");
            rc = -1;
        }
    }
    return rc;
}
开发者ID:trws,项目名称:flux-core,代码行数:13,代码来源:jstatctl.c

示例5: START_TEST

END_TEST


//  --------------------------------------------------------------------------
/// Try to _pop () two succeesding lists
START_TEST(test_msg_pop_l_double)
{
    sam_selftest_introduce ("test_msg_pop_l_double");

    sam_selftest_introduce ("test_msg_get_l_double");
    zmsg_t *zmsg = zmsg_new ();

    if (zmsg_pushstr (zmsg, "two") ||
        zmsg_pushstr (zmsg, "1")   ||
        zmsg_pushstr (zmsg, "one") ||
        zmsg_pushstr (zmsg, "1")) {
        ck_abort_msg ("could not build zmsg");
    }

    sam_msg_t *msg = sam_msg_new (&zmsg);
    ck_assert_int_eq (sam_msg_size (msg), 4);

    zlist_t *list1, *list2;
    int rc = sam_msg_pop (msg, "ll", &list1, &list2);
    ck_assert_int_eq (rc, 0);
    ck_assert_int_eq (sam_msg_size (msg), 0);

    ck_assert_int_eq (zlist_size (list1), 1);
    ck_assert_int_eq (zlist_size (list2), 1);

    ck_assert_str_eq (zlist_first (list1), "one");
    ck_assert_str_eq (zlist_first (list2), "two");

    zlist_destroy (&list1);
    zlist_destroy (&list2);

    sam_msg_destroy (&msg);
}
开发者ID:dreadworks,项目名称:samwise,代码行数:38,代码来源:sam_msg_test.c

示例6: s_worker_ready

static void
s_worker_ready (worker_t *self, zlist_t *workers)
{
    worker_t *worker = (worker_t *) zlist_first (workers);
    while (worker) {
        if (streq (self->identity, worker->identity)) {
            zlist_remove (workers, worker);
            s_worker_destroy (&worker);
            break;
        }
        worker = (worker_t *) zlist_next (workers);
    }
    zlist_append (workers, self);
}
开发者ID:Carl4,项目名称:zguide,代码行数:14,代码来源:ppqueue.c

示例7: s_was_pending

//  If message was already on pending list, remove it and return true,
//  else return false.
static int
s_was_pending (clonesrv_t *self, kvmsg_t *kvmsg)
{
    kvmsg_t *held = (kvmsg_t *) zlist_first (self->pending);
    while (held) {
        if (memcmp (kvmsg_uuid (kvmsg),
                    kvmsg_uuid (held), sizeof (uuid_t)) == 0) {
            zlist_remove (self->pending, held);
            return true;
        }
        held = (kvmsg_t *) zlist_next (self->pending);
    }
    return false;
}
开发者ID:CaiZhongda,项目名称:zguide,代码行数:16,代码来源:clonesrv6.c

示例8: pass_update

void
pass_update (char *sender, zlist_t *fmetadata) 
{
    printf ("[ST] PASS_UPDATE from %s: %"PRId64"\n", sender, zlist_size (fmetadata));
    uint64_t size = 0;
    zlist_t *paths = zlist_new ();
    zs_fmetadata_t *meta = zlist_first (fmetadata);
    while (meta) {
        zlist_append (paths, zs_fmetadata_path (meta));
        size += zs_fmetadata_size (meta);
        meta = zlist_next (fmetadata);
    }
    zsync_agent_send_request_files (agent, sender, paths, size);
}
开发者ID:skyformat99,项目名称:protocol,代码行数:14,代码来源:zsync_selftest.c

示例9: disp_table_remove_all

halutils_err_e disp_table_remove_all (disp_table_t *self)
{
    assert (self);

    zlist_t *hash_keys = zhash_keys (self->table_h);
    void * table_item = zlist_first (hash_keys);

    for (; table_item; table_item = zlist_next (hash_keys)) {
        zhash_delete (self->table_h, (char *) table_item);
    }

    zlist_destroy (&hash_keys);
    return HALUTILS_SUCCESS;
}
开发者ID:julianofjm,项目名称:bpm-software,代码行数:14,代码来源:dispatch_table.c

示例10: zlist_first

const char *flux_kvsitr_next (flux_kvsitr_t *itr)
{
    const char *name = NULL;

    if (itr) {
        if (itr->reset)
            name = zlist_first (itr->keys);
        else
            name = zlist_next (itr->keys);
        if (name)
            itr->reset = false;
    }
    return name;
}
开发者ID:flux-framework,项目名称:flux-core,代码行数:14,代码来源:kvs_dir.c

示例11: subprocess_run_hooks

static int subprocess_run_hooks (struct subprocess *p, zlist_t *hooks)
{
    subprocess_cb_f fn = zlist_first (hooks);
    int rc = 0;
    subprocess_ref (p);
    while (fn) {
        if ((rc = fn (p)) < 0)
            goto done;
        fn = zlist_next (hooks);
    }
done:
    subprocess_unref (p);
    return (rc);
}
开发者ID:cigolabs,项目名称:flux-core,代码行数:14,代码来源:subprocess.c

示例12: zcertstore_fprint

void
zcertstore_fprint (zcertstore_t *self, FILE *file)
{
    if (self->location)
        fprintf (file, "Certificate store at %s:\n", self->location);
    else
        fprintf (file, "Certificate store\n");

    zcert_t *cert = (zcert_t *) zlist_first (self->cert_list);
    while (cert) {
        zcert_fprint (cert, file);
        cert = (zcert_t *) (zcert_t *) zlist_next (self->cert_list);
    }
}
开发者ID:Prarrot,项目名称:czmq,代码行数:14,代码来源:zcertstore.c

示例13: zctx_destroy

void
zctx_destroy (zctx_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zctx_t *self = *self_p;
        while (zlist_size (self->sockets))
            zctx__socket_destroy (self, zlist_first (self->sockets));
        zlist_destroy (&self->sockets);
        if (self->main && self->context)
            zmq_term (self->context);
        free (self);
        *self_p = NULL;
    }
}
开发者ID:dnaeon,项目名称:czmq,代码行数:15,代码来源:zctx.c

示例14: mount_sub_purge

static void
mount_sub_purge (mount_t *self, client_t *client)
{
    sub_t *sub = (sub_t *) zlist_first (self->subs);
    while (sub) {
        if (sub->client == client) {
            sub_t *next = (sub_t *) zlist_next (self->subs);
            zlist_remove (self->subs, sub);
            sub_destroy (&sub);
            sub = next;
        }
        else
            sub = (sub_t *) zlist_next (self->subs);
    }
}
开发者ID:JuanCerezuela,项目名称:filemq,代码行数:15,代码来源:fmq_server.c

示例15: subscription_match

static bool subscription_match (client_t *c, const flux_msg_t *msg)
{
    subscription_t *sub;
    const char *topic;

    if (flux_msg_get_topic (msg, &topic) < 0)
        return false;
    sub = zlist_first (c->subscriptions);
    while (sub) {
        if (!strncmp (topic, sub->topic, strlen (sub->topic)))
            return true;
        sub = zlist_next (c->subscriptions);
    }
    return false;
}
开发者ID:dinesh121991,项目名称:flux-core,代码行数:15,代码来源:local.c


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