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


C++ zlist_destroy函数代码示例

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


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

示例1: zconfig_destroy

void
zconfig_destroy (zconfig_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zconfig_t *self = *self_p;

        //  Destroy all children and siblings recursively
        if (self->child)
            zconfig_destroy (&self->child);
        if (self->next)
            zconfig_destroy (&self->next);
        zlist_destroy (&self->comments);
        free (self->name);
        free (self->value);
        free (self);
        *self_p = NULL;
    }
}
开发者ID:AndreasBomholtz,项目名称:czmq,代码行数:19,代码来源:zconfig.c

示例2: client_destroy

static void
client_destroy (client_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        client_t *self = *self_p;
        fmq_config_destroy (&self->config);
        fmq_msg_destroy (&self->request);
        fmq_msg_destroy (&self->reply);
        //  Destroy subscriptions                         
        while (zlist_size (self->subs)) {                 
            sub_t *sub = (sub_t *) zlist_pop (self->subs);
            sub_destroy (&sub);                           
        }                                                 
        zlist_destroy (&self->subs);                      
        free (self);
        *self_p = NULL;
    }
}
开发者ID:zoobab,项目名称:filemq,代码行数:19,代码来源:fmq_client.c

示例3: zconfig_comment

void
zconfig_comment (zconfig_t *self, char *format, ...)
{
    if (format) {
        if (!self->comments) {
            self->comments = zlist_new ();
            zlist_autofree (self->comments);
        }
        va_list argptr;
        va_start (argptr, format);
        char *string = zsys_vprintf (format, argptr);
        va_end (argptr);
        
        zlist_append (self->comments, string);
        free (string);
    }
    else
        zlist_destroy (&self->comments);
}
开发者ID:AndreasBomholtz,项目名称:czmq,代码行数:19,代码来源:zconfig.c

示例4: zsync_node_destroy

static void
zsync_node_destroy (zsync_node_t **self_p)
{
    assert (self_p);

    if (*self_p) {
        zsync_node_t *self = *self_p;
        
        zuuid_destroy (&self->own_uuid);
      
        // TODO destroy all zsync_peers
        zlist_destroy (&self->peers);
        zhash_destroy (&self->zyre_peers);
        zyre_destroy (&self->zyre);

        free (self);
        self_p = NULL;
    }
}
开发者ID:skyformat99,项目名称:protocol,代码行数:19,代码来源:zsync_node.c

示例5: main

int main(void)
{
	zctx_t *ctx = zctx_new();
	lbbroker_t *self = (lbbroker_t *)zmalloc(sizeof(lbbroker_t));
	self->frontend = zsocket_new(ctx, ZMQ_ROUTER);
	self->backend = zsocket_new(ctx, ZMQ_ROUTER);

#if (defined (WIN32))
	zsocket_bind(self->frontend, "tcp://*:5672"); // frontend
	zsocket_bind(self->backend, "tcp://*:5673"); // backend
#else
	zsocket_bind(self->frontend, "ipc://frontend.ipc");
	zsocket_bind(self->backend, "ipc://backend.ipc");
#endif

	int client_nbr;
	for (client_nbr = 0; client_nbr < NBR_CLIENTS; client_nbr++)
		zthread_new(client_task, NULL);
	int worker_nbr;
	for (worker_nbr = 0; worker_nbr < NBR_WORKERS; worker_nbr++)
		zthread_new(worker_task, NULL);

	// Queue of available workers
	self->workers = zlist_new();

	// Prepare reactor and fire it up
	zloop_t *reactor = zloop_new();
	zmq_pollitem_t poller = { self->backend, 0, ZMQ_POLLIN };
	zloop_poller(reactor, &poller, s_handle_backend, self);
	zloop_start(reactor);
	zloop_destroy(&reactor);

	// When we're done, clean up properly
	while (zlist_size(self->workers)) {
		zframe_t *frame = (zframe_t *)zlist_pop(self->workers);
		zframe_destroy(&frame);
	}
	zlist_destroy(&self->workers);
	zctx_destroy(&ctx);
	free(self);
	return 0;
}
开发者ID:a524631266,项目名称:Ongoing-Study,代码行数:42,代码来源:lbbroker3.c

示例6: main

/*
PUB tcp://*:9003
<<  [ "(?stock:[A-Z][A-Z0-9]+)" ]
    [ timestamp :f64            ]
    [ price     :f64            ]
*/
int main(int argc, const char* argv[])
{
  SetConsoleTitle(L"tickz.server");

  // initialize random number generator
  srand( (unsigned int)time(NULL) );

  // initialize stock data
  tick_t msft = tick_new("MSFT", 41.78);
  tick_t aapl = tick_new("AAPL", 95.35);
  tick_t goog = tick_new("GOOG",571.09);
  tick_t yhoo = tick_new("YHOO", 34.53);
  tick_t bbry = tick_new("BBRY", 10.90);
  
  zlist_t *stocks = zlist_new();
  zlist_append(stocks,&msft);
  zlist_append(stocks,&aapl);
  zlist_append(stocks,&goog);
  zlist_append(stocks,&yhoo);
  zlist_append(stocks,&bbry);
  
  // set up publisher
  zctx_t *ctx = zctx_new();
  void *pub = zsocket_new(ctx,ZMQ_PUB);
  zsocket_bind(pub,"tcp://*:9003");

  // set up main loop
  zloop_t *loop = zloop_new();
  zloop_data_t loopdata;
  loopdata.stocks = stocks;
  loopdata.socket = pub;

  // every 500 ms, update the stocks and publish the new data
  int timer = zloop_timer(loop,500,0,onloop,&loopdata); //TOOD: take delay as input
  zloop_start(loop); //NOTE: CTRL+C will cleanly interrupt the infinite loop
  
  // clean up
  zctx_destroy(&ctx);
  zlist_destroy(&stocks);

  return 0;
}
开发者ID:linnet,项目名称:BeyondTheBox,代码行数:48,代码来源:Program.c

示例7: cleanup_push

void cleanup_push (cleaner_fun_f *fun, void * arg)
{
    pthread_mutex_lock(&mutex);
    if (! cleanup_list || cleaner_pid != getpid())
    {
        // This odd dance is to handle forked processes that do not exec
        if (cleaner_pid != 0 && cleanup_list) {
            zlist_destroy(&cleanup_list);
        }
        cleanup_list = zlist_new();
        cleaner_pid = getpid();
        atexit(cleanup);
    }
    struct cleaner * c = calloc(sizeof(struct cleaner), 1);
    c->fun = fun;
    c->arg = arg;
    /* Ignore return code, no way to return it callery anyway... */
    (void) zlist_push(cleanup_list, c);
    pthread_mutex_unlock(&mutex);
}
开发者ID:tpatki,项目名称:flux-core,代码行数:20,代码来源:cleanup.c

示例8: zinterface_test

void
zinterface_test(bool verbose)
{
    printf(" * zinterface: ");
    zlist_t *interfaces = zinterface_list();
    assert(interfaces);

    if (verbose) {
        printf("Len: %zu\n", zlist_size(interfaces));
        zinterface_t *iface = zlist_first(interfaces);
        while (iface) {
            printf ("%s\t%s\t%s\t%s\n", zinterface_name(iface), zinterface_address(iface),
                zinterface_netmask(iface), zinterface_broadcast(iface));
            iface = zlist_next(interfaces);
        }
    }

    zlist_destroy(&interfaces);
    printf("OK\n");
}
开发者ID:VanL,项目名称:czmq,代码行数:20,代码来源:zinterface.c

示例9: ztask_job_request_dump

void
ztask_job_request_dump (ztask_job_request_t *self)
{
    assert (self);
    zclock_log("ztask_job_request: Processes=%ld", zhash_size (self->processes));
    zlist_t *keys = zhash_keys (self->processes);
    char *key = (char *) zlist_first (keys);
    ztask_job_proc_t *p;
    while (key) {
        zclock_log ("ztask_job_request: key=%s", key);
        p = (ztask_job_proc_t *) zhash_lookup (self->processes, key);
        ztask_job_proc_dump (p);
        key = (char *) zlist_next (keys);
    }

    zlist_destroy (&keys);



}
开发者ID:savke,项目名称:ztask0,代码行数:20,代码来源:ztask_job_request.c

示例10: zlist_dup

zlist_t *
zlist_dup (zlist_t *self)
{
    if (!self)
        return NULL;

    zlist_t *copy = zlist_new ();
    copy->autofree = self->autofree;

    if (copy) {
        node_t *node;
        for (node = self->head; node; node = node->next) {
            if (!zlist_append (copy, node->item)) {
                zlist_destroy (&copy);
                break;
            }
        }
    }
    return copy;
}
开发者ID:bakirtasa,项目名称:czmq,代码行数:20,代码来源:zlist.c

示例11: zconfig_destroy

void
zconfig_destroy (zconfig_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zconfig_t *self = *self_p;

        //  Destroy all children and siblings recursively
        zconfig_destroy (&self->child);
        zconfig_destroy (&self->next);

        //  Destroy other properties and then self
        zlist_destroy (&self->comments);
        zfile_destroy (&self->file);
        free (self->name);
        free (self->value);
        free (self);
        *self_p = NULL;
    }
}
开发者ID:RUNDSP,项目名称:czmq,代码行数:20,代码来源:zconfig.c

示例12: zhash_comment

void
zhash_comment (zhash_t *self, const char *format, ...)
{
    if (format) {
        if (!self->comments) {
            self->comments = zlist_new ();
            if (!self->comments)
                return;
            zlist_autofree (self->comments);
        }
        va_list argptr;
        va_start (argptr, format);
        char *string = zsys_vprintf (format, argptr);
        va_end (argptr);
        if (string)
            zlist_append (self->comments, string);
        zstr_free (&string);
    }
    else
        zlist_destroy (&self->comments);
}
开发者ID:ritchiecarroll,项目名称:czmq,代码行数:21,代码来源:zhash.c

示例13: zre_msg_destroy

void
zre_msg_destroy (zre_msg_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zre_msg_t *self = *self_p;

        //  Free class properties
        zframe_destroy (&self->routing_id);
        free (self->ipaddress);
        if (self->groups)
            zlist_destroy (&self->groups);
        zhash_destroy (&self->headers);
        zmsg_destroy (&self->content);
        free (self->group);

        //  Free object itself
        free (self);
        *self_p = NULL;
    }
}
开发者ID:karinies,项目名称:coast,代码行数:21,代码来源:zre_msg.c

示例14: zctx_destroy

void
zctx_destroy (zctx_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zctx_t *self = *self_p;

        //  Destroy all sockets
        while (zlist_size (self->sockets))
            zctx__socket_destroy (self, zlist_first (self->sockets));
        zlist_destroy (&self->sockets);
        zmutex_destroy (&self->mutex);

        //  ZMQ context may not yet be instantiated
        if (self->context && !self->shadow)
            zmq_term (self->context);

        free (self);
        *self_p = NULL;
    }
}
开发者ID:calid,项目名称:czmq,代码行数:21,代码来源:zctx.c

示例15: module_start_all

int module_start_all (modhash_t *mh)
{
    zlist_t *uuids;
    char *uuid;
    int rc = -1;

    if (!(uuids = zhash_keys (mh->zh_byuuid)))
        oom ();
    uuid = zlist_first (uuids);
    while (uuid) {
        module_t *p = zhash_lookup (mh->zh_byuuid, uuid);
        assert (p != NULL);
        if (module_start (p) < 0)
            goto done;
        uuid = zlist_next (uuids);
    }
    rc = 0;
done:
    zlist_destroy (&uuids);
    return rc;
}
开发者ID:surajpkn,项目名称:flux-core,代码行数:21,代码来源:module.c


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