mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-12-04 14:46:31 -05:00
Fix: Corrected namespace for threading part
This commit is contained in:
parent
2ed4716a10
commit
6404c9a156
16
avl/avl.c
16
avl/avl.c
@ -56,7 +56,7 @@ igloo_avl_node_new (void * key,
|
|||||||
AVL_SET_BALANCE (node, 0);
|
AVL_SET_BALANCE (node, 0);
|
||||||
AVL_SET_RANK (node, 1);
|
AVL_SET_RANK (node, 1);
|
||||||
#ifdef HAVE_AVL_NODE_LOCK
|
#ifdef HAVE_AVL_NODE_LOCK
|
||||||
thread_rwlock_create(&node->rwlock);
|
igloo_thread_rwlock_create(&node->rwlock);
|
||||||
#endif
|
#endif
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ igloo_avl_tree_new (igloo_avl_key_compare_fun_type compare_fun,
|
|||||||
t->length = 0;
|
t->length = 0;
|
||||||
t->compare_fun = compare_fun;
|
t->compare_fun = compare_fun;
|
||||||
t->compare_arg = compare_arg;
|
t->compare_arg = compare_arg;
|
||||||
thread_rwlock_create(&t->rwlock);
|
igloo_thread_rwlock_create(&t->rwlock);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1164,32 +1164,32 @@ igloo_avl_print_tree (igloo_avl_tree * tree, igloo_avl_key_printer_fun_type key_
|
|||||||
|
|
||||||
void igloo_avl_tree_rlock(igloo_avl_tree *tree)
|
void igloo_avl_tree_rlock(igloo_avl_tree *tree)
|
||||||
{
|
{
|
||||||
thread_rwlock_rlock(&tree->rwlock);
|
igloo_thread_rwlock_rlock(&tree->rwlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void igloo_avl_tree_wlock(igloo_avl_tree *tree)
|
void igloo_avl_tree_wlock(igloo_avl_tree *tree)
|
||||||
{
|
{
|
||||||
thread_rwlock_wlock(&tree->rwlock);
|
igloo_thread_rwlock_wlock(&tree->rwlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void igloo_avl_tree_unlock(igloo_avl_tree *tree)
|
void igloo_avl_tree_unlock(igloo_avl_tree *tree)
|
||||||
{
|
{
|
||||||
thread_rwlock_unlock(&tree->rwlock);
|
igloo_thread_rwlock_unlock(&tree->rwlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_AVL_NODE_LOCK
|
#ifdef HAVE_AVL_NODE_LOCK
|
||||||
void avl_node_rlock(igloo_avl_node *node)
|
void avl_node_rlock(igloo_avl_node *node)
|
||||||
{
|
{
|
||||||
thread_rwlock_rlock(&node->rwlock);
|
igloo_thread_rwlock_rlock(&node->rwlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void avl_node_wlock(igloo_avl_node *node)
|
void avl_node_wlock(igloo_avl_node *node)
|
||||||
{
|
{
|
||||||
thread_rwlock_wlock(&node->rwlock);
|
igloo_thread_rwlock_wlock(&node->rwlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void avl_node_unlock(igloo_avl_node *node)
|
void avl_node_unlock(igloo_avl_node *node)
|
||||||
{
|
{
|
||||||
thread_rwlock_unlock(&node->rwlock);
|
igloo_thread_rwlock_unlock(&node->rwlock);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -113,20 +113,20 @@ typedef igloo_mutex_t igloo_spin_t;
|
|||||||
#define igloo_thread_spin_unlock(x) thread_mutex_unlock(x)
|
#define igloo_thread_spin_unlock(x) thread_mutex_unlock(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define thread_create(n,x,y,z) igloo_thread_create_c(n,x,y,z,__LINE__,__FILE__)
|
#define igloo_thread_create(n,x,y,z) igloo_thread_create_c(n,x,y,z,__LINE__,__FILE__)
|
||||||
#define thread_mutex_create(x) igloo_thread_mutex_create_c(x,__LINE__,__FILE__)
|
#define igloo_thread_mutex_create(x) igloo_thread_mutex_create_c(x,__LINE__,__FILE__)
|
||||||
#define thread_mutex_lock(x) igloo_thread_mutex_lock_c(x,__LINE__,__FILE__)
|
#define igloo_thread_mutex_lock(x) igloo_thread_mutex_lock_c(x,__LINE__,__FILE__)
|
||||||
#define thread_mutex_unlock(x) igloo_thread_mutex_unlock_c(x,__LINE__,__FILE__)
|
#define igloo_thread_mutex_unlock(x) igloo_thread_mutex_unlock_c(x,__LINE__,__FILE__)
|
||||||
#define thread_cond_create(x) igloo_thread_cond_create_c(x,__LINE__,__FILE__)
|
#define igloo_thread_cond_create(x) igloo_thread_cond_create_c(x,__LINE__,__FILE__)
|
||||||
#define thread_cond_signal(x) igloo_thread_cond_signal_c(x,__LINE__,__FILE__)
|
#define igloo_thread_cond_signal(x) igloo_thread_cond_signal_c(x,__LINE__,__FILE__)
|
||||||
#define thread_cond_broadcast(x) igloo_thread_cond_broadcast_c(x,__LINE__,__FILE__)
|
#define igloo_thread_cond_broadcast(x) igloo_thread_cond_broadcast_c(x,__LINE__,__FILE__)
|
||||||
#define thread_cond_wait(x) igloo_thread_cond_wait_c(x,__LINE__,__FILE__)
|
#define igloo_thread_cond_wait(x) igloo_thread_cond_wait_c(x,__LINE__,__FILE__)
|
||||||
#define thread_cond_timedwait(x,t) igloo_thread_cond_wait_c(x,t,__LINE__,__FILE__)
|
#define igloo_thread_cond_timedwait(x,t) igloo_thread_cond_wait_c(x,t,__LINE__,__FILE__)
|
||||||
#define thread_rwlock_create(x) igloo_thread_rwlock_create_c(x,__LINE__,__FILE__)
|
#define igloo_thread_rwlock_create(x) igloo_thread_rwlock_create_c(x,__LINE__,__FILE__)
|
||||||
#define thread_rwlock_rlock(x) igloo_thread_rwlock_rlock_c(x,__LINE__,__FILE__)
|
#define igloo_thread_rwlock_rlock(x) igloo_thread_rwlock_rlock_c(x,__LINE__,__FILE__)
|
||||||
#define thread_rwlock_wlock(x) igloo_thread_rwlock_wlock_c(x,__LINE__,__FILE__)
|
#define igloo_thread_rwlock_wlock(x) igloo_thread_rwlock_wlock_c(x,__LINE__,__FILE__)
|
||||||
#define thread_rwlock_unlock(x) igloo_thread_rwlock_unlock_c(x,__LINE__,__FILE__)
|
#define igloo_thread_rwlock_unlock(x) igloo_thread_rwlock_unlock_c(x,__LINE__,__FILE__)
|
||||||
#define thread_exit(x) igloo_thread_exit_c(x,__LINE__,__FILE__)
|
#define igloo_thread_exit(x) igloo_thread_exit_c(x,__LINE__,__FILE__)
|
||||||
|
|
||||||
#define igloo_MUTEX_STATE_NOTLOCKED -1
|
#define igloo_MUTEX_STATE_NOTLOCKED -1
|
||||||
#define igloo_MUTEX_STATE_NEVERLOCKED -2
|
#define igloo_MUTEX_STATE_NEVERLOCKED -2
|
||||||
@ -136,7 +136,7 @@ typedef igloo_mutex_t igloo_spin_t;
|
|||||||
|
|
||||||
/* init/shutdown of the library */
|
/* init/shutdown of the library */
|
||||||
void igloo_thread_initialize(void);
|
void igloo_thread_initialize(void);
|
||||||
void thread_initialize_with_log_id(int log_id);
|
void igloo_thread_initialize_with_log_id(int log_id);
|
||||||
void igloo_thread_shutdown(void);
|
void igloo_thread_shutdown(void);
|
||||||
|
|
||||||
/* creation, destruction, locking, unlocking, signalling and waiting */
|
/* creation, destruction, locking, unlocking, signalling and waiting */
|
||||||
|
@ -44,10 +44,10 @@
|
|||||||
#ifndef NO_THREAD
|
#ifndef NO_THREAD
|
||||||
#include "../include/igloo/thread.h"
|
#include "../include/igloo/thread.h"
|
||||||
#else
|
#else
|
||||||
#define thread_mutex_create(x) do{}while(0)
|
#define igloo_thread_mutex_create(x) do{}while(0)
|
||||||
#define igloo_thread_mutex_destroy(x) do{}while(0)
|
#define igloo_thread_mutex_destroy(x) do{}while(0)
|
||||||
#define thread_mutex_lock(x) do{}while(0)
|
#define igloo_thread_mutex_lock(x) do{}while(0)
|
||||||
#define thread_mutex_unlock(x) do{}while(0)
|
#define igloo_thread_mutex_unlock(x) do{}while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../include/igloo/resolver.h"
|
#include "../include/igloo/resolver.h"
|
||||||
@ -163,7 +163,7 @@ char *igloo_resolver_getname(const char *ip, char *buff, int len)
|
|||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_mutex_lock(&igloo__resolver_mutex);
|
igloo_thread_mutex_lock(&igloo__resolver_mutex);
|
||||||
if (inet_aton (ip, &addr)) {
|
if (inet_aton (ip, &addr)) {
|
||||||
/* casting &addr to const char* as it is recommended on win* */
|
/* casting &addr to const char* as it is recommended on win* */
|
||||||
if ((host=gethostbyaddr ((const char *)&addr, sizeof (struct in_addr), AF_INET)))
|
if ((host=gethostbyaddr ((const char *)&addr, sizeof (struct in_addr), AF_INET)))
|
||||||
@ -173,7 +173,7 @@ char *igloo_resolver_getname(const char *ip, char *buff, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_mutex_unlock(&igloo__resolver_mutex);
|
igloo_thread_mutex_unlock(&igloo__resolver_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ char *igloo_resolver_getip(const char *name, char *buff, int len)
|
|||||||
buff [len-1] = '\0';
|
buff [len-1] = '\0';
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
thread_mutex_lock(&igloo__resolver_mutex);
|
igloo_thread_mutex_lock(&igloo__resolver_mutex);
|
||||||
host = gethostbyname(name);
|
host = gethostbyname(name);
|
||||||
if (host)
|
if (host)
|
||||||
{
|
{
|
||||||
@ -196,7 +196,7 @@ char *igloo_resolver_getip(const char *name, char *buff, int len)
|
|||||||
ret = strncpy(buff, temp, len);
|
ret = strncpy(buff, temp, len);
|
||||||
buff [len-1] = '\0';
|
buff [len-1] = '\0';
|
||||||
}
|
}
|
||||||
thread_mutex_unlock(&igloo__resolver_mutex);
|
igloo_thread_mutex_unlock(&igloo__resolver_mutex);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ void igloo_resolver_initialize()
|
|||||||
if (!igloo__initialized)
|
if (!igloo__initialized)
|
||||||
{
|
{
|
||||||
igloo__initialized = 1;
|
igloo__initialized = 1;
|
||||||
thread_mutex_create (&igloo__resolver_mutex);
|
igloo_thread_mutex_create (&igloo__resolver_mutex);
|
||||||
|
|
||||||
/* keep dns connects (TCP) open */
|
/* keep dns connects (TCP) open */
|
||||||
#ifdef HAVE_SETHOSTENT
|
#ifdef HAVE_SETHOSTENT
|
||||||
|
@ -168,8 +168,8 @@ void igloo_thread_initialize(void)
|
|||||||
igloo_avl_insert(_mutextree, (void *)&_mutextree_mutex);
|
igloo_avl_insert(_mutextree, (void *)&_mutextree_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
thread_mutex_create(&igloo__threadtree_mutex);
|
igloo_thread_mutex_create(&igloo__threadtree_mutex);
|
||||||
thread_mutex_create(&igloo__library_mutex);
|
igloo_thread_mutex_create(&igloo__library_mutex);
|
||||||
|
|
||||||
/* initialize the thread tree and insert the main thread */
|
/* initialize the thread tree and insert the main thread */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user