use ast_atomic_fetchadd_int for incrementing resultcount
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80226 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
35ade91df6
commit
5eb7cbef42
|
@ -94,7 +94,6 @@ struct odbc_datastore {
|
||||||
AST_LIST_HEAD_STATIC(queries, acf_odbc_query);
|
AST_LIST_HEAD_STATIC(queries, acf_odbc_query);
|
||||||
|
|
||||||
static int resultcount = 0;
|
static int resultcount = 0;
|
||||||
AST_MUTEX_DEFINE_STATIC(resultlock);
|
|
||||||
|
|
||||||
static void odbc_datastore_free(void *data)
|
static void odbc_datastore_free(void *data)
|
||||||
{
|
{
|
||||||
|
@ -448,9 +447,7 @@ end_acf_read:
|
||||||
if (resultset) {
|
if (resultset) {
|
||||||
int uid;
|
int uid;
|
||||||
struct ast_datastore *odbc_store;
|
struct ast_datastore *odbc_store;
|
||||||
ast_mutex_lock(&resultlock);
|
uid = ast_atomic_fetchadd_int(&resultcount, +1) + 1;
|
||||||
uid = ++resultcount;
|
|
||||||
ast_mutex_unlock(&resultlock);
|
|
||||||
snprintf(buf, len, "%d", uid);
|
snprintf(buf, len, "%d", uid);
|
||||||
odbc_store = ast_channel_datastore_alloc(&odbc_info, buf);
|
odbc_store = ast_channel_datastore_alloc(&odbc_info, buf);
|
||||||
if (!odbc_store) {
|
if (!odbc_store) {
|
||||||
|
|
Loading…
Reference in New Issue