summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_mem_cache_pool.h
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-01-17 20:00:00 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-01-17 20:00:00 +0300
commit16cbf3c076a0aca6d47adaf3f719493674cf2363 (patch)
treee6530480020f62a2bdbf249988ec3e2a751d3927 /src/nxt_mem_cache_pool.h
downloadunit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.gz
unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.bz2
Initial version.
Diffstat (limited to 'src/nxt_mem_cache_pool.h')
-rw-r--r--src/nxt_mem_cache_pool.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/nxt_mem_cache_pool.h b/src/nxt_mem_cache_pool.h
new file mode 100644
index 00000000..4df73624
--- /dev/null
+++ b/src/nxt_mem_cache_pool.h
@@ -0,0 +1,40 @@
+
+/*
+ * Copyright (C) Igor Sysoev
+ * Copyright (C) NGINX, Inc.
+ */
+
+#ifndef _NXT_MEM_CACHE_POOL_H_INCLUDED_
+#define _NXT_MEM_CACHE_POOL_H_INCLUDED_
+
+
+typedef struct nxt_mem_cache_pool_s nxt_mem_cache_pool_t;
+
+
+NXT_EXPORT nxt_mem_cache_pool_t *nxt_mem_cache_pool_create(size_t cluster_size,
+ size_t page_alignment, size_t page_size, size_t min_chunk_size)
+ NXT_MALLOC_LIKE;
+NXT_EXPORT nxt_mem_cache_pool_t *
+ nxt_mem_cache_pool_fast_create(size_t cluster_size,
+ size_t page_alignment, size_t page_size, size_t min_chunk_size)
+ NXT_MALLOC_LIKE;
+NXT_EXPORT nxt_bool_t nxt_mem_cache_pool_is_empty(nxt_mem_cache_pool_t *pool);
+NXT_EXPORT void nxt_mem_cache_pool_destroy(nxt_mem_cache_pool_t *pool);
+
+NXT_EXPORT void *nxt_mem_cache_alloc(nxt_mem_cache_pool_t *pool, size_t size)
+ NXT_MALLOC_LIKE;
+NXT_EXPORT void *nxt_mem_cache_zalloc(nxt_mem_cache_pool_t *pool, size_t size)
+ NXT_MALLOC_LIKE;
+NXT_EXPORT void *nxt_mem_cache_align(nxt_mem_cache_pool_t *pool,
+ size_t alignment, size_t size)
+ NXT_MALLOC_LIKE;
+NXT_EXPORT void *nxt_mem_cache_zalign(nxt_mem_cache_pool_t *pool,
+ size_t alignment, size_t size)
+ NXT_MALLOC_LIKE;
+NXT_EXPORT void nxt_mem_cache_free(nxt_mem_cache_pool_t *pool, void *p);
+
+
+extern const nxt_mem_proto_t nxt_mem_cache_proto;
+
+
+#endif /* _NXT_MEM_CACHE_POOL_H_INCLUDED_ */