Skip to content

Commit feb72d0

Browse files
authored
Merge pull request #267 from cboulay/capi_size_approx
Expose size_approx in C API
2 parents 0753496 + 263e7b4 commit feb72d0

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ build/msvc12/obj/
2121
build/msvc11/*.log
2222
build/msvc11/obj/
2323
build/xcode/build/
24+
.idea/
25+
cmake-build*/
2426
tests/fuzztests/fuzztests.log
2527
benchmarks/benchmarks.log
2628
tests/CDSChecker/*.o

c_api/concurrentqueue.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,9 @@ int moodycamel_cq_try_dequeue(MoodycamelCQHandle handle, MoodycamelValue* value)
3131
return reinterpret_cast<MoodycamelCQPtr>(handle)->try_dequeue(*value) ? 1 : 0;
3232
}
3333

34+
size_t moodycamel_cq_size_approx(MoodycamelCQHandle handle)
35+
{
36+
return reinterpret_cast<MoodycamelCQPtr>(handle)->size_approx();
37+
}
38+
3439
}

c_api/concurrentqueue.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <stddef.h>
4+
35
#ifdef __cplusplus
46
extern "C" {
57
#endif
@@ -26,6 +28,7 @@ MOODYCAMEL_EXPORT int moodycamel_cq_create(MoodycamelCQHandle* handle);
2628
MOODYCAMEL_EXPORT int moodycamel_cq_destroy(MoodycamelCQHandle handle);
2729
MOODYCAMEL_EXPORT int moodycamel_cq_enqueue(MoodycamelCQHandle handle, MoodycamelValue value);
2830
MOODYCAMEL_EXPORT int moodycamel_cq_try_dequeue(MoodycamelCQHandle handle, MoodycamelValue* value);
31+
MOODYCAMEL_EXPORT size_t moodycamel_cq_size_approx(MoodycamelCQHandle handle);
2932

3033
MOODYCAMEL_EXPORT int moodycamel_bcq_create(MoodycamelBCQHandle* handle);
3134
MOODYCAMEL_EXPORT int moodycamel_bcq_destroy(MoodycamelBCQHandle handle);

0 commit comments

Comments
 (0)