1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05:00
icecast-server/src/global.c

63 lines
1.5 KiB
C
Raw Normal View History

/* 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,
* Michael Smith <msmith@xiph.org>,
* oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org>
* and others (see AUTHORS for details).
2022-03-01 06:17:28 -05:00
* Copyright 2015-2022, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include "common/thread/thread.h"
#include "common/avl/avl.h"
#include "global.h"
#include "refobject.h"
#include "module.h"
2018-05-28 07:27:04 -04:00
#include "source.h"
ice_global_t global;
static mutex_t _global_mutex;
void global_initialize(void)
{
global.listensockets = NULL;
global.relays = NULL;
global.master_relays = NULL;
global.running = 0;
global.clients = 0;
global.sources = 0;
global.sources_legacy = 0;
global.source_tree = avl_tree_new(source_compare_sources, NULL);
global.modulecontainer = refobject_new(module_container_t);
thread_mutex_create(&_global_mutex);
}
void global_shutdown(void)
{
thread_mutex_destroy(&_global_mutex);
refobject_unref(global.modulecontainer);
avl_tree_free(global.source_tree, NULL);
}
void global_lock(void)
{
thread_mutex_lock(&_global_mutex);
}
void global_unlock(void)
{
thread_mutex_unlock(&_global_mutex);
}