1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-01-03 14:56:34 -05:00

Use gnu archive ACX_PTHREAD macro to figure out how to compile thread support.

Also make it possible to build libshout without threads, albeit without locking
in the resolver or avl trees.
New option --disable-pthread too.

svn path=/trunk/avl/; revision=4411
This commit is contained in:
brendan 2003-03-06 01:55:20 +00:00
parent f5059c261e
commit cbfe325c2f
3 changed files with 23 additions and 4 deletions

View File

@ -2,7 +2,7 @@
* Copyright (C) 1995 by Sam Rushing <rushing@nightmare.com> * Copyright (C) 1995 by Sam Rushing <rushing@nightmare.com>
*/ */
/* $Id: avl.h,v 1.2 2002/02/11 09:11:18 msmith Exp $ */ /* $Id: avl.h,v 1.3 2003/03/06 01:55:20 brendan Exp $ */
#ifndef __AVL_H #ifndef __AVL_H
#define __AVL_H #define __AVL_H
@ -11,7 +11,15 @@
extern "C" { extern "C" {
#endif #endif
#ifdef USE_THREAD
#include "thread.h" #include "thread.h"
#else
#define thread_rwlock_create(x)
#define thread_rwlock_destroy(x)
#define thread_rwlock_rlock(x)
#define thread_rwlock_wlock(x)
#define thread_rwlock_unlock(x)
#endif
typedef struct avl_node_tag { typedef struct avl_node_tag {
void * key; void * key;
@ -24,8 +32,9 @@ typedef struct avl_node_tag {
* The rest of the bits are used for <rank> * The rest of the bits are used for <rank>
*/ */
unsigned long rank_and_balance; unsigned long rank_and_balance;
#ifdef USE_THREAD
rwlock_t rwlock; rwlock_t rwlock;
#endif
} avl_node; } avl_node;
#define AVL_GET_BALANCE(n) ((int)(((n)->rank_and_balance & 3) - 1)) #define AVL_GET_BALANCE(n) ((int)(((n)->rank_and_balance & 3) - 1))
@ -59,8 +68,9 @@ typedef struct _avl_tree {
unsigned long length; unsigned long length;
avl_key_compare_fun_type compare_fun; avl_key_compare_fun_type compare_fun;
void * compare_arg; void * compare_arg;
#ifdef USE_THREAD
rwlock_t rwlock; rwlock_t rwlock;
#endif
} avl_tree; } avl_tree;
avl_tree * avl_tree_new (avl_key_compare_fun_type compare_fun, void * compare_arg); avl_tree * avl_tree_new (avl_key_compare_fun_type compare_fun, void * compare_arg);

View File

@ -9,7 +9,6 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "thread.h"
#include "avl.h" #include "avl.h"
#include "httpp.h" #include "httpp.h"

View File

@ -19,7 +19,15 @@
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#ifdef USE_THREAD
#include "../thread/thread.h" #include "../thread/thread.h"
#else
#define thread_mutex_create(x)
#define thread_mutex_destroy(x)
#define thread_mutex_lock(x)
#define thread_mutex_unlock(x)
#endif
#include "resolver.h" #include "resolver.h"
#include "sock.h" #include "sock.h"
@ -29,7 +37,9 @@ static int _isip(const char *what);
/* internal data */ /* internal data */
#ifdef USE_THREAD
static mutex_t _resolver_mutex; static mutex_t _resolver_mutex;
#endif
static int _initialized = 0; static int _initialized = 0;
#ifdef HAVE_INET_PTON #ifdef HAVE_INET_PTON