Skip to content
This repository was archived by the owner on Oct 9, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ AC_CONFIG_FILES([Makefile
test/regres/Makefile
test/regres/lock/Makefile
test/regres/cond/Makefile
test/regres/mem/Makefile
test/regres/list/Makefile
test/regres/queue/Makefile
test/perf/Makefile
Expand Down
1 change: 1 addition & 0 deletions src/include/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ zm_headers = \
include/cond/zm_cond_types.h \
include/cond/zm_ccond.h \
include/cond/zm_scount.h \
include/mem/zm_pool.h \
include/queue/zm_queue_types.h \
include/queue/zm_glqueue.h \
include/queue/zm_swpqueue.h \
Expand Down
19 changes: 19 additions & 0 deletions src/include/mem/zm_pool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* See COPYRIGHT in top-level directory.
*/

#ifndef _ZM_POOL_H_
#define _ZM_POOL_H_

#include "common/zm_common.h"
#include <stdio.h>

typedef zm_ptr_t *zm_pool_t;

int zm_pool_create(size_t element_size, zm_pool_t *handle);
int zm_pool_destroy(zm_pool_t *handle);
int zm_pool_alloc(zm_pool_t handle, void **ptr);
int zm_pool_free(zm_pool_t handle, void *ptr);

#endif /* _ZM_POOL_H_ */
2 changes: 2 additions & 0 deletions src/include/queue/zm_queue_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef _ZM_QUEUE_TYPES_H
#define _ZM_QUEUE_TYPES_H
#include "common/zm_common.h"
#include "mem/zm_pool.h"
#include <pthread.h>
#include <limits.h>

Expand Down Expand Up @@ -40,6 +41,7 @@ struct zm_msqnode {
struct zm_msqueue {
zm_atomic_ptr_t head ZM_ALLIGN_TO_CACHELINE;
zm_atomic_ptr_t tail ZM_ALLIGN_TO_CACHELINE;
zm_pool_t pool ZM_ALLIGN_TO_CACHELINE;
};

/* faqueue */
Expand Down
5 changes: 5 additions & 0 deletions src/include/queue/zm_swpqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ int zm_swpqueue_dequeue(zm_swpqueue_t* q, void **data);
int zm_swpqueue_isempty_weak(zm_swpqueue_t* q);
int zm_swpqueue_isempty_strong(zm_swpqueue_t* q);

int zm_swpqueue_init_explicit(zm_swpqueue_t *);
int zm_swpqueue_enqueue_explicit(zm_swpqueue_t* q, void *data);
int zm_swpqueue_dequeue_explicit(zm_swpqueue_t* q, void **data);


#endif /* _ZM_SWPQUEUE_H */
4 changes: 2 additions & 2 deletions src/mem/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#

zm_sources += \
mem/zm_hzdptr.c

mem/zm_hzdptr.c \
mem/zm_pool.c
Loading