2004-01-29 01:02:12 +00:00
|
|
|
/* Icecast
|
|
|
|
*
|
|
|
|
* This program is distributed under the GNU General Public License, version 2.
|
|
|
|
* A copy of this license is included with this source.
|
|
|
|
*
|
2015-01-10 18:53:44 +00:00
|
|
|
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
2004-01-29 01:02:12 +00:00
|
|
|
* Michael Smith <msmith@xiph.org>,
|
|
|
|
* oddsock <oddsock@xiph.org>,
|
|
|
|
* Karl Heyes <karl@xiph.org>
|
|
|
|
* and others (see AUTHORS for details).
|
|
|
|
*/
|
|
|
|
|
2003-03-27 17:10:14 +00:00
|
|
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
2003-07-21 01:58:54 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-03-09 11:27:06 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2014-12-02 22:50:57 +01:00
|
|
|
#include "common/thread/thread.h"
|
|
|
|
#include "common/avl/avl.h"
|
|
|
|
#include "common/httpp/httpp.h"
|
2001-09-10 02:21:46 +00:00
|
|
|
|
|
|
|
#include "connection.h"
|
|
|
|
#include "refbuf.h"
|
2002-08-16 14:26:48 +00:00
|
|
|
#include "client.h"
|
2001-09-10 02:21:46 +00:00
|
|
|
#include "source.h"
|
2002-12-30 07:55:56 +00:00
|
|
|
#include "format.h"
|
2001-09-10 02:21:46 +00:00
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
ice_global_t global;
|
|
|
|
|
|
|
|
static mutex_t _global_mutex;
|
|
|
|
|
|
|
|
void global_initialize(void)
|
|
|
|
{
|
2003-03-15 02:10:19 +00:00
|
|
|
global.server_sockets = 0;
|
2004-02-19 20:28:21 +00:00
|
|
|
global.relays = NULL;
|
|
|
|
global.master_relays = NULL;
|
2003-03-15 02:10:19 +00:00
|
|
|
global.running = 0;
|
|
|
|
global.clients = 0;
|
|
|
|
global.sources = 0;
|
|
|
|
global.source_tree = avl_tree_new(source_compare_sources, NULL);
|
|
|
|
thread_mutex_create(&_global_mutex);
|
2001-09-10 02:21:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void global_shutdown(void)
|
|
|
|
{
|
2003-03-15 02:10:19 +00:00
|
|
|
thread_mutex_destroy(&_global_mutex);
|
2004-02-19 20:28:21 +00:00
|
|
|
avl_tree_free(global.source_tree, NULL);
|
2001-09-10 02:21:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void global_lock(void)
|
|
|
|
{
|
2003-03-15 02:10:19 +00:00
|
|
|
thread_mutex_lock(&_global_mutex);
|
2001-09-10 02:21:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void global_unlock(void)
|
|
|
|
{
|
2003-03-15 02:10:19 +00:00
|
|
|
thread_mutex_unlock(&_global_mutex);
|
2001-09-10 02:21:46 +00:00
|
|
|
}
|