Commit bdb5be2a authored by brendan's avatar brendan
Browse files

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
parent d4a50b97
...@@ -2,7 +2,7 @@ ...@@ -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 @@ ...@@ -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 { ...@@ -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 { ...@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment