mutex uuid creation
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16067 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
638790af30
commit
0c63f02f75
|
@ -74,6 +74,8 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include "uuid.h"
|
||||
|
||||
/* #define DEBUG_ALLOC */
|
||||
#define DO_EVENTS
|
||||
|
||||
|
@ -192,6 +194,7 @@ struct switch_runtime {
|
|||
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||
uint32_t flags;
|
||||
switch_time_t timestamp;
|
||||
switch_mutex_t *uuid_mutex;
|
||||
switch_mutex_t *throttle_mutex;
|
||||
switch_mutex_t *session_hash_mutex;
|
||||
switch_mutex_t *global_mutex;
|
||||
|
@ -212,6 +215,7 @@ struct switch_runtime {
|
|||
char *odbc_user;
|
||||
char *odbc_pass;
|
||||
uint32_t debug_level;
|
||||
uuid_t *uuid;
|
||||
};
|
||||
|
||||
extern struct switch_runtime runtime;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#ifndef WIN32
|
||||
#include <switch_private.h>
|
||||
#endif
|
||||
#include "private/switch_core_pvt.h"
|
||||
|
||||
/* apr headers*/
|
||||
#include <apr.h>
|
||||
|
@ -882,11 +883,13 @@ SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid)
|
|||
|
||||
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid)
|
||||
{
|
||||
switch_mutex_lock(runtime.uuid_mutex);
|
||||
#ifndef WIN32
|
||||
apr_uuid_get((apr_uuid_t *) uuid);
|
||||
#else
|
||||
UuidCreate((UUID*)uuid);
|
||||
#endif
|
||||
switch_mutex_unlock(runtime.uuid_mutex);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str)
|
||||
|
|
|
@ -1165,7 +1165,6 @@ static void switch_core_set_serial(void)
|
|||
switch_core_set_variable("switch_serial", buf);
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
|
||||
{
|
||||
switch_uuid_t uuid;
|
||||
|
@ -1176,7 +1175,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
|||
char hostname[256] = "";
|
||||
|
||||
memset(&runtime, 0, sizeof(runtime));
|
||||
|
||||
|
||||
runtime.dummy_cng_frame.data = runtime.dummy_data;
|
||||
runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
|
||||
runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data);
|
||||
|
@ -1202,6 +1201,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
|||
}
|
||||
switch_assert(runtime.memory_pool != NULL);
|
||||
|
||||
|
||||
dir_path = switch_mprintf("%s%ssounds", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
|
||||
switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
||||
switch_safe_free(dir_path);
|
||||
|
@ -1216,6 +1216,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
|||
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
||||
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.temp_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
||||
|
||||
switch_mutex_init(&runtime.uuid_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
|
||||
|
||||
switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
|
||||
switch_mutex_init(&runtime.session_hash_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
|
||||
|
|
Loading…
Reference in New Issue