1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-29 04:25:55 -04:00

Require NO_THREAD to be defined to turn off locking in avl and net

According to Karl, defining nops with do{}while(0) is a la mode.

svn path=/trunk/avl/; revision=4412
This commit is contained in:
brendan 2003-03-06 02:35:12 +00:00
parent cbfe325c2f
commit 3274bc38d4
2 changed files with 16 additions and 16 deletions

View File

@ -2,7 +2,7 @@
* Copyright (C) 1995 by Sam Rushing <rushing@nightmare.com>
*/
/* $Id: avl.h,v 1.3 2003/03/06 01:55:20 brendan Exp $ */
/* $Id: avl.h,v 1.4 2003/03/06 02:35:12 brendan Exp $ */
#ifndef __AVL_H
#define __AVL_H
@ -11,14 +11,14 @@
extern "C" {
#endif
#ifdef USE_THREAD
#ifndef NO_THREAD
#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)
#define thread_rwlock_create(x) do{}while(0)
#define thread_rwlock_destroy(x) do{}while(0)
#define thread_rwlock_rlock(x) do{}while(0)
#define thread_rwlock_wlock(x) do{}while(0)
#define thread_rwlock_unlock(x) do{}while(0)
#endif
typedef struct avl_node_tag {
@ -32,7 +32,7 @@ typedef struct avl_node_tag {
* The rest of the bits are used for <rank>
*/
unsigned long rank_and_balance;
#ifdef USE_THREAD
#ifndef NO_THREAD
rwlock_t rwlock;
#endif
} avl_node;
@ -68,7 +68,7 @@ typedef struct _avl_tree {
unsigned long length;
avl_key_compare_fun_type compare_fun;
void * compare_arg;
#ifdef USE_THREAD
#ifndef NO_THREAD
rwlock_t rwlock;
#endif
} avl_tree;

View File

@ -19,13 +19,13 @@
#include <winsock2.h>
#endif
#ifdef USE_THREAD
#include "../thread/thread.h"
#ifndef NO_THREAD
#include "thread.h"
#else
#define thread_mutex_create(x)
#define thread_mutex_destroy(x)
#define thread_mutex_lock(x)
#define thread_mutex_unlock(x)
#define thread_mutex_create(x) do{}while(0)
#define thread_mutex_destroy(x) do{}while(0)
#define thread_mutex_lock(x) do{}while(0)
#define thread_mutex_unlock(x) do{}while(0)
#endif
#include "resolver.h"
@ -37,7 +37,7 @@ static int _isip(const char *what);
/* internal data */
#ifdef USE_THREAD
#ifndef NO_THREAD
static mutex_t _resolver_mutex;
#endif
static int _initialized = 0;