Skip to content

Commit a3544bc

Browse files
committed
Merge pull request #95 from hintjens/master
Fixed HWM=1 on thread pipes
2 parents 286c5d2 + 5b8f5ea commit a3544bc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/zhash.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ zhash_size (zhash_t *self)
379379
// --------------------------------------------------------------------------
380380
// Make copy of hash table
381381
// Does not copy items themselves. Rebuilds new table so may be slow on
382-
// very large tables.
382+
// very large tables. NOTE: only works with item values that are strings
383+
// since there's no other way to know how to duplicate the item value.
383384

384385
zhash_t *
385386
zhash_dup (zhash_t *self)
@@ -393,7 +394,8 @@ zhash_dup (zhash_t *self)
393394
for (index = 0; index != self->limit; index++) {
394395
item_t *item = self->items [index];
395396
while (item) {
396-
zhash_insert (copy, item->key, item->value);
397+
zhash_insert (copy, item->key, strdup (item->value));
398+
zhash_freefn (copy, item->key, free);
397399
item = item->next;
398400
}
399401
}

src/zthread.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args)
199199
shim->pipe = zsocket_new (shim->ctx, ZMQ_PAIR);
200200
if (!shim->pipe)
201201
return NULL;
202-
zsocket_set_hwm (shim->pipe, 1);
203202
zsocket_connect (shim->pipe, "inproc://zctx-pipe-%p", pipe);
204203

205204
s_thread_start (shim);

0 commit comments

Comments
 (0)