diff options
author | Russell Bryant <russell@russellbryant.com> | 2007-08-21 21:58:29 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2007-08-21 21:58:29 +0000 |
commit | 5eb7cbef4268df4e89b66bef0d02b801f65de006 (patch) | |
tree | 124d17a1f2852366dd19ec40b104b18e2fbad557 /funcs | |
parent | 35ade91df6f99b04df01b8bf67206ba9a241a79b (diff) |
use ast_atomic_fetchadd_int for incrementing resultcount
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80226 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs')
-rw-r--r-- | funcs/func_odbc.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index ee80fcc98..f9272fe88 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -94,7 +94,6 @@ struct odbc_datastore { AST_LIST_HEAD_STATIC(queries, acf_odbc_query); static int resultcount = 0; -AST_MUTEX_DEFINE_STATIC(resultlock); static void odbc_datastore_free(void *data) { @@ -448,9 +447,7 @@ end_acf_read: if (resultset) { int uid; struct ast_datastore *odbc_store; - ast_mutex_lock(&resultlock); - uid = ++resultcount; - ast_mutex_unlock(&resultlock); + uid = ast_atomic_fetchadd_int(&resultcount, +1) + 1; snprintf(buf, len, "%d", uid); odbc_store = ast_channel_datastore_alloc(&odbc_info, buf); if (!odbc_store) { |