diff --git a/pjlib/include/pj/stack.h b/pjlib/include/pj/stack.h index 6e9cf32611..da68ce5258 100644 --- a/pjlib/include/pj/stack.h +++ b/pjlib/include/pj/stack.h @@ -47,8 +47,6 @@ #endif // PJ_STACK_IMPLEMENTATION -#include - PJ_BEGIN_DECL @@ -64,7 +62,7 @@ PJ_BEGIN_DECL * Stack in PJLIB is single-linked list with First In Last Out logic. * Stack is thread safe. Common PJLIB stack implementation uses internal locking mechanism so is thread-safe. * Implementation for Windows platform uses locking free Windows embeded single linked list implementation. - * The performance of pj_stack implementation for Windows platform is 2-5x higher than cross-platform. + * The performance of pj_stack implementation for Windows platform is considerably higher than cross-platform. * * By default pjlib compile and link os independent "cross-platform" implementation. * To select implementation you may optionaly define PJ_STACK_IMPLEMENTATION as PJ_STACK_WIN32 @@ -77,13 +75,14 @@ PJ_BEGIN_DECL * * Windows single linked list implementation requires aligned data, both stack item and stack itself should * be aligned by 8 (for x86) or 16 (for x64) byte. - * pjsip build system define PJ_POOL_ALIGNMENT macro to corresponding value. * winnt.h define MEMORY_ALLOCATION_ALIGNMENT macro for this purpose. - * To use this macro in build system we recomend (this is optional) to add #include - * to your config_site.h. + * pjsip build system define PJ_POOL_ALIGNMENT macro to corresponding value. * You may redefine PJ_POOL_ALIGNMENT in your config_site.h but to use PJ_STACK_WIN32 implementation * PJ_POOL_ALIGNMENTshould not be less then MEMORY_ALLOCATION_ALIGNMENT * + * To use MEMORY_ALLOCATION_ALIGNMENT macro in build system we recomend (this is optional) to add + * #include to your config_site.h. + * * Stack won't require dynamic memory allocation (just as all PJLIB data structures). The stack here * should be viewed more like a low level C stack instead of high level C++ stack * (which normally are easier to use but require dynamic memory allocations), diff --git a/pjlib/src/pj/stack.c b/pjlib/src/pj/stack.c index f0d99db880..624f53ecde 100644 --- a/pjlib/src/pj/stack.c +++ b/pjlib/src/pj/stack.c @@ -143,12 +143,6 @@ PJ_DEF(pj_stack_t*) pj_stack_pop(pj_stack_type *stack) * Traverse the stack and get it's elements quantity. * The return value of pj_stack_size should not be relied upon in multithreaded applications * because the item count can be changed at any time by another thread. - * For Windows platform returns the number of entries in the stack modulo 65535. For example, - * if the specified stack contains 65536 entries, pj_stack_size returns zero. - * - * @param stack The target stack. - * - * @return Number of elements. */ PJ_DEF(pj_size_t) pj_stack_size(/*const*/ pj_stack_type *stack) { diff --git a/pjlib/src/pj/stack_win32.c b/pjlib/src/pj/stack_win32.c index 0335e3adba..f315dcb6f8 100644 --- a/pjlib/src/pj/stack_win32.c +++ b/pjlib/src/pj/stack_win32.c @@ -140,10 +140,6 @@ PJ_DEF(pj_stack_t*) pj_stack_pop(pj_stack_type *stack) * because the item count can be changed at any time by another thread. * For Windows platform returns the number of entries in the stack modulo 65535. For example, * if the specified stack contains 65536 entries, pj_stack_size returns zero. - * - * @param stack The target stack. - * - * @return Number of elements. */ PJ_DEF(pj_size_t) pj_stack_size(/*const*/ pj_stack_type *stack) { diff --git a/pjlib/src/pjlib-test/stack.c b/pjlib/src/pjlib-test/stack.c index 3bb6c811a8..ed16d5f5a0 100644 --- a/pjlib/src/pjlib-test/stack.c +++ b/pjlib/src/pjlib-test/stack.c @@ -51,6 +51,15 @@ #endif +/* define this variable to control multithreaded testing for other platforms */ +#ifndef HAS_MT_STACK_STRESS_TEST +# ifdef PJ_WIN32 +# define HAS_MT_STACK_STRESS_TEST 1 +# endif +# define HAS_MT_STACK_STRESS_TEST 0 +# endif +#endif + #define THIS_FILE "stack.c" #define MAX_RESERVED 16 #define MAX_SLOTS 100 @@ -215,10 +224,12 @@ int stack_test() rc = -55; } +#ifdef HAS_MT_STACK_STRESS_TEST for (i = 0; !rc && i < PJ_ARRAY_SIZE(tests); ++i) { tests[i].state.pool = pool; rc = stack_stress_test(&tests[i]); } +#endif //HAS_MT_STACK_STRESS_TEST if (pool) pj_pool_release(pool);