本文整理汇总了C++中zlist_remove函数的典型用法代码示例。如果您正苦于以下问题:C++ zlist_remove函数的具体用法?C++ zlist_remove怎么用?C++ zlist_remove使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zlist_remove函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zmsg_remove
void
zmsg_remove (zmsg_t *self, zframe_t *frame)
{
assert (self);
self->content_size -= zframe_size (frame);
zlist_remove (self->frames, frame);
}
示例2: sub_patch_add
static void
sub_patch_add (sub_t *self, fmq_patch_t *patch)
{
// Skip file creation if client already has identical file
fmq_patch_digest_set (patch);
if (fmq_patch_op (patch) == patch_create) {
char *digest = zhash_lookup (self->cache, fmq_patch_virtual (patch));
if (digest && strcasecmp (digest, fmq_patch_digest (patch)) == 0)
return; // Just skip patch for this client
}
// Remove any previous patches for the same file
fmq_patch_t *existing = (fmq_patch_t *) zlist_first (self->client->patches);
while (existing) {
if (streq (fmq_patch_virtual (patch), fmq_patch_virtual (existing))) {
zlist_remove (self->client->patches, existing);
fmq_patch_destroy (&existing);
break;
}
existing = (fmq_patch_t *) zlist_next (self->client->patches);
}
if (fmq_patch_op (patch) == patch_create)
zhash_insert (self->cache,
fmq_patch_digest (patch), fmq_patch_virtual (patch));
// Track that we've queued patch for client, so we don't do it twice
zlist_append (self->client->patches, fmq_patch_dup (patch));
}
示例3: s_worker_delete
static void s_worker_delete(worker_t *self, int disconnect)
{
assert (self);
if (disconnect) {
s_worker_send (self, MDPW_DISCONNECT, NULL); // ! Расширить до отключение через mmi
}
if (self->service) {
zlist_remove (self->service->waiting, self);
self->service->workers--;
}
zlist_remove (self->broker->waiting, self);
// This implicitly calls s_worker_destroy
zhash_delete (self->broker->workers, self->id_string);
}
示例4: wait_destroy_msg
int wait_destroy_msg (waitqueue_t *q, wait_test_msg_f cb, void *arg)
{
zlist_t *tmp = NULL;
wait_t *w;
int rc = -1;
int count = 0;
assert (q->magic == WAITQUEUE_MAGIC);
w = zlist_first (q->q);
while (w) {
if (w->hand.msg && cb != NULL && cb (w->hand.msg, arg)) {
if (!tmp && !(tmp = zlist_new ()))
oom ();
if (zlist_append (tmp, w) < 0)
oom ();
w->hand.cb = NULL; // prevent wait_runone from restarting handler
count++;
}
w = zlist_next (q->q);
}
if (tmp) {
while ((w = zlist_pop (tmp))) {
zlist_remove (q->q, w);
if (--w->usecount == 0)
wait_destroy (w);
}
}
rc = count;
zlist_destroy (&tmp);
return rc;
}
示例5: subprocess_free
static void subprocess_free (struct subprocess *p)
{
assert (p != NULL);
if (p->sm)
zlist_remove (p->sm->processes, (void *) p);
zhash_destroy (&p->zhash);
hooks_table_free (p);
fda_closeall (p->child_fda);
if (p->argz)
free (p->argz);
if (p->envz)
free (p->envz);
if (p->cwd)
free (p->cwd);
zio_destroy (p->zio_in);
zio_destroy (p->zio_out);
zio_destroy (p->zio_err);
if (p->parentfd != -1)
close (p->parentfd);
if (p->childfd != -1)
close (p->childfd);
flux_watcher_destroy (p->child_watcher);
memset (p, 0, sizeof (*p));
free (p);
}
示例6: s_engine_handle_buy_request
static void
s_engine_handle_buy_request (engine_t *self, zframe_t *price,
zframe_t *volume, zframe_t *reply_to)
{
char *price_str = zframe_strdup (price);
char *volume_str = zframe_strdup (volume);
order_t *buy_order = s_order_new (self->worker,
atoi (price_str), atoi (volume_str), reply_to);
free (price_str);
free (volume_str);
while (buy_order->volume) {
order_t *sell_order = s_engine_match_sell_order (self);
if (sell_order == NULL || sell_order->price > buy_order->price)
break;
int volume = MIN (buy_order->volume, sell_order->volume);
s_order_update (buy_order, volume);
s_order_update (sell_order, volume);
if (sell_order->volume == 0) {
zlist_remove (self->sell_orders, sell_order);
s_order_destroy (&sell_order);
}
}
if (buy_order->volume == 0)
s_order_destroy (&buy_order);
else
zlist_append (self->buy_orders, buy_order);
}
示例7: zctx__socket_destroy
void
zctx__socket_destroy (zctx_t *self, void *zocket)
{
assert (self);
assert (zocket);
zsocket_set_linger (zocket, self->linger);
zmq_close (zocket);
zlist_remove (self->sockets, zocket);
}
示例8: s_service_enable_command
static void
s_service_enable_command (service_t *self, const char *command)
{
char *item = (char *) zlist_first (self->blacklist);
while (item && !streq (item, command))
item = (char *) zlist_next (self->blacklist);
if (item) {
zlist_remove (self->blacklist, item);
free (item);
}
}
示例9: s_worker_delete
static void
s_worker_delete(worker_t *self, int disconnect)
{
assert(self);
if (disconnect) {
mdp_msg_t *msg = mdp_msg_new();
assert(msg);
mdp_msg_set_id(msg, MDP_MSG_DISCONNECT);
mdp_msg_set_routing_id(msg, self->address);
mdp_msg_send(msg, self->broker->router);
}
if (self->service) {
zlist_remove(self->service->waiting, self);
self->service->workers--;
}
zlist_remove(self->broker->waiting, self);
// This implicitly calls s_worker_destroy.
zhash_delete(self->broker->workers, self->identity);
}
示例10: 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);
}
}
示例11: s_workers_purge
static void
s_workers_purge (zlist_t *workers)
{
worker_t *worker = (worker_t *) zlist_first (workers);
while (worker) {
if (zclock_time () < worker->expiry)
break; // Worker is alive, we're done here
zlist_remove (workers, worker);
s_worker_destroy (&worker);
worker = (worker_t *) zlist_first (workers);
}
}
示例12: 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);
}
示例13: 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;
}
示例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);
}
}
示例15: s_service_dispatch
static void s_service_dispatch(service_t *self, zmsg_t *msg)
{
assert(self);
if (msg) { // Queue message if any
zlist_append(self->requests, msg);
}
s_broker_purge(self->broker);
while (zlist_size(self->waiting) && zlist_size(self->requests)) {
worker_t *worker = zlist_pop(self->waiting);
zlist_remove(self->broker->waiting, worker);
zmsg_t *msg = zlist_pop(self->requests);
s_worker_send(worker, MDPW_REQUEST, msg);
zmsg_destroy (&msg);
}
}