Merge pull request #267 from cboulay/capi_size_approx

Expose size_approx in C API
This commit is contained in:
Cameron
2021-10-25 23:18:26 -04:00
committed by GitHub
3 changed files with 10 additions and 0 deletions

2
.gitignore vendored
View File

@@ -21,6 +21,8 @@ build/msvc12/obj/
build/msvc11/*.log
build/msvc11/obj/
build/xcode/build/
.idea/
cmake-build*/
tests/fuzztests/fuzztests.log
benchmarks/benchmarks.log
tests/CDSChecker/*.o

View File

@@ -31,4 +31,9 @@ int moodycamel_cq_try_dequeue(MoodycamelCQHandle handle, MoodycamelValue* value)
return reinterpret_cast<MoodycamelCQPtr>(handle)->try_dequeue(*value) ? 1 : 0;
}
size_t moodycamel_cq_size_approx(MoodycamelCQHandle handle)
{
return reinterpret_cast<MoodycamelCQPtr>(handle)->size_approx();
}
}

View File

@@ -1,5 +1,7 @@
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -26,6 +28,7 @@ MOODYCAMEL_EXPORT int moodycamel_cq_create(MoodycamelCQHandle* handle);
MOODYCAMEL_EXPORT int moodycamel_cq_destroy(MoodycamelCQHandle handle);
MOODYCAMEL_EXPORT int moodycamel_cq_enqueue(MoodycamelCQHandle handle, MoodycamelValue value);
MOODYCAMEL_EXPORT int moodycamel_cq_try_dequeue(MoodycamelCQHandle handle, MoodycamelValue* value);
MOODYCAMEL_EXPORT size_t moodycamel_cq_size_approx(MoodycamelCQHandle handle);
MOODYCAMEL_EXPORT int moodycamel_bcq_create(MoodycamelBCQHandle* handle);
MOODYCAMEL_EXPORT int moodycamel_bcq_destroy(MoodycamelBCQHandle handle);