mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 12:52:33 +00:00
initial implementation of support for native atomic ops.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@16601 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
11
utils.c
11
utils.c
@@ -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.
|
||||
|
Reference in New Issue
Block a user