2003-03-27 12:10:14 -05:00
|
|
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
2003-03-09 06:27:06 -05:00
|
|
|
#include <string.h>
|
|
|
|
|
2003-07-16 15:41:59 -04:00
|
|
|
#include "thread/thread.h"
|
|
|
|
#include "avl/avl.h"
|
|
|
|
#include "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-09 06:27:06 -05:00
|
|
|
memset(global.serversock, 0, sizeof(int)*MAX_LISTEN_SOCKETS);
|
2003-03-14 21:10:19 -05:00
|
|
|
global.server_sockets = 0;
|
|
|
|
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);
|
|
|
|
avl_tree_free(global.source_tree, source_free_source);
|
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
|
|
|
}
|