diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-30 23:26:22 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-30 23:26:22 +0000 |
commit | 1baf6ed3268f3de5f44a2a3569e6e697275f4247 (patch) | |
tree | d523df419b44c5c8864b03fcdb19286787e75e01 /utils.c | |
parent | 4e54af4b6c019d63964a1fc476a8c6ad7c538d25 (diff) |
initial implementation of support for native atomic ops.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@16601 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -39,6 +39,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") +#define AST_API_MODULE /* ensure that inlinable API functions will be built in lock.h if required */ #include "asterisk/lock.h" #include "asterisk/io.h" #include "asterisk/logger.h" @@ -1049,6 +1050,16 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr, va_end(ap2); } +AST_MUTEX_DEFINE_STATIC(fetchadd_m); /* used for all fetc&add ops */ +int ast_atomic_fetchadd_int_slow(volatile int *p, int v) +{ + int ret; + ast_mutex_lock(&fetchadd_m); + ret = *p; + *p += v; + ast_mutex_unlock(&fetchadd_m); + return ret; +} /*! \brief * get values from config variables. |