2004-01-28 20:02:12 -05: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 13:53:44 -05:00
|
|
|
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
2004-01-28 20:02:12 -05:00
|
|
|
* Michael Smith <msmith@xiph.org>,
|
|
|
|
* oddsock <oddsock@xiph.org>,
|
|
|
|
* Karl Heyes <karl@xiph.org>
|
|
|
|
* and others (see AUTHORS for details).
|
|
|
|
*/
|
|
|
|
|
2003-03-27 12:10:14 -05:00
|
|
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
2003-07-20 21:58:54 -04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-03-09 06:27:06 -05:00
|
|
|
#include <string.h>
|
|
|
|
|
2014-12-02 16:50:57 -05:00
|
|
|
#include "common/thread/thread.h"
|
|
|
|
#include "common/avl/avl.h"
|
|
|
|
#include "common/httpp/httpp.h"
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
#include "connection.h"
|
|
|
|
#include "refbuf.h"
|
2002-08-16 10:26:48 -04:00
|
|
|
#include "client.h"
|
2001-09-09 22:21:46 -04:00
|
|
|
#include "source.h"
|
2002-12-30 02:55:56 -05:00
|
|
|
#include "format.h"
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
ice_global_t global;
|
|
|
|
|
|
|
|
static mutex_t _global_mutex;
|
|
|
|
|
|
|
|
void global_initialize(void)
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
global.server_sockets = 0;
|
2004-02-19 15:28:21 -05:00
|
|
|
global.relays = NULL;
|
|
|
|
global.master_relays = NULL;
|
2003-03-14 21:10:19 -05: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-09 22:21:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void global_shutdown(void)
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
thread_mutex_destroy(&_global_mutex);
|
2004-02-19 15:28:21 -05:00
|
|
|
avl_tree_free(global.source_tree, NULL);
|
2001-09-09 22:21:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void global_lock(void)
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
thread_mutex_lock(&_global_mutex);
|
2001-09-09 22:21:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void global_unlock(void)
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
thread_mutex_unlock(&_global_mutex);
|
2001-09-09 22:21:46 -04:00
|
|
|
}
|