1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-29 04:25:55 -04:00

avoid aliasing issues

svn path=/icecast/branches/kh/icecast/; revision=7928
This commit is contained in:
Karl Heyes 2004-10-07 19:18:07 +00:00
parent 0a6d8f5c55
commit 4e1906ee99
3 changed files with 23 additions and 22 deletions

View File

@ -75,10 +75,10 @@ typedef struct _thread_queue_tag {
} thread_queue_t;
static mutex_t _connection_mutex;
static unsigned long _current_id = 0;
static volatile unsigned long _current_id = 0;
static int _initialized = 0;
static con_queue_t *_queue = NULL, **_queue_tail = &_queue;
static volatile con_queue_t *_queue = NULL, **_queue_tail = &_queue;
static mutex_t _queue_mutex;
static thread_queue_t *_conhands = NULL;
@ -264,7 +264,7 @@ static void _add_connection(connection_t *con)
node->next = NULL;
thread_mutex_lock(&_queue_mutex);
*_queue_tail = node;
_queue_tail = &node->next;
_queue_tail = (volatile con_queue_t **)&node->next;
thread_mutex_unlock(&_queue_mutex);
}
@ -388,9 +388,9 @@ static connection_t *_get_connection(void)
thread_mutex_lock(&_queue_mutex);
if (_queue) {
node = _queue;
node = (con_queue_t *)_queue;
_queue = node->next;
if (_queue_tail == &node->next)
if ((con_queue_t**)_queue_tail == &node->next)
_queue_tail = &_queue;
}
thread_mutex_unlock(&_queue_mutex);

View File

@ -64,8 +64,8 @@ static void _add_slave_host (const char *server, int port);
static thread_type *_slave_thread_id;
static int slave_running = 0;
static unsigned int max_interval = 0;
static int rescan_relays = 0;
static volatile unsigned int max_interval = 0;
static volatile int rescan_relays = 0;
static rwlock_t slaves_lock;
relay_server *relay_free (relay_server *relay)

View File

@ -84,8 +84,8 @@ typedef struct ypdata_tag
static rwlock_t yp_lock;
static mutex_t yp_pending_lock;
static struct yp_server *active_yps = NULL, *pending_yps = NULL;
static int yp_update = 0;
static volatile struct yp_server *active_yps = NULL, *pending_yps = NULL;
static volatile int yp_update = 0;
static int yp_running;
static time_t now;
static thread_type *yp_thread;
@ -153,14 +153,14 @@ static struct yp_server *find_yp_server (const char *url)
{
struct yp_server *server;
server = active_yps;
server = (struct yp_server *)active_yps;
while (server)
{
if (strcmp (server->url, url) == 0)
return server;
server = server->next;
}
server = pending_yps;
server = (struct yp_server *)pending_yps;
while (server)
{
if (strcmp (server->url, url) == 0)
@ -208,7 +208,7 @@ void yp_recheck_config (ice_config_t *config)
DEBUG0("Updating YP configuration");
thread_rwlock_rlock (&yp_lock);
server = active_yps;
server = (struct yp_server *)active_yps;
while (server)
{
server->remove = 1;
@ -246,7 +246,7 @@ void yp_recheck_config (ice_config_t *config)
curl_easy_setopt (server->curl, CURLOPT_TIMEOUT, server->url_timeout);
curl_easy_setopt (server->curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (server->curl, CURLOPT_ERRORBUFFER, &(server->curl_error[0]));
server->next = pending_yps;
server->next = (struct yp_server *)pending_yps;
pending_yps = server;
INFO3 ("Adding new YP server \"%s\" (timeout %ds, default interval %ds)",
server->url, server->url_timeout, server->touch_interval);
@ -538,7 +538,8 @@ static ypdata_t *create_yp_entry (source_t *source)
/* Check for changes in the YP servers configured */
static void check_servers ()
{
struct yp_server *server = active_yps, **server_p = &active_yps;
struct yp_server *server = (struct yp_server *)active_yps,
**server_p = (struct yp_server **)&active_yps;
while (server)
{
@ -559,11 +560,11 @@ static void check_servers ()
{
avl_node *node;
server = pending_yps;
server = (struct yp_server *)pending_yps;
pending_yps = server->next;
DEBUG1("Add pending yps %s", server->url);
server->next = active_yps;
server->next = (struct yp_server *)active_yps;
active_yps = server;
/* new YP server configured, need to populate with existing sources */
@ -648,7 +649,7 @@ static void *yp_update_thread(void *arg)
/* do the YP communication */
thread_rwlock_rlock (&yp_lock);
server = active_yps;
server = (struct yp_server *)active_yps;
while (server)
{
/* DEBUG1 ("trying %s", server->url); */
@ -662,7 +663,7 @@ static void *yp_update_thread(void *arg)
{
thread_rwlock_wlock (&yp_lock);
check_servers ();
server = active_yps;
server = (struct yp_server *)active_yps;
while (server)
{
/* DEBUG1 ("Checking yps %s", server->url); */
@ -679,7 +680,7 @@ static void *yp_update_thread(void *arg)
/* free server and ypdata left */
while (active_yps)
{
struct yp_server *server = active_yps;
struct yp_server *server = (struct yp_server *)active_yps;
active_yps = server->next;
destroy_yp_server (server);
}
@ -831,7 +832,7 @@ void yp_add (source_t *source)
/* make sure we don't race against another yp_add */
thread_mutex_lock (&yp_pending_lock);
server = active_yps;
server = (struct yp_server *)active_yps;
while (server)
{
ypdata_t *yp;
@ -857,7 +858,7 @@ void yp_add (source_t *source)
/* Mark an existing entry in the YP list as to be marked for deletion */
void yp_remove (const char *mount)
{
struct yp_server *server = active_yps;
struct yp_server *server = (struct yp_server *)active_yps;
thread_rwlock_rlock (&yp_lock);
while (server)
@ -879,7 +880,7 @@ void yp_remove (const char *mount)
* attempt */
void yp_touch (const char *mount)
{
struct yp_server *server = active_yps;
struct yp_server *server = (struct yp_server *)active_yps;
time_t trigger;
ypdata_t *search_list = NULL;