|
From: Carlo W. <li...@us...> - 2002-01-08 23:05:13
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2002-00-08 23:05:09 UTC
Modified files:
libcwd/configure.in libcwd/include/sys.ho.in
libcwd/include/libcw/class_channel.h
libcwd/include/libcw/class_channel.inl
libcwd/include/libcw/class_location.h
libcwd/include/libcw/class_location.inl
libcwd/include/libcw/debug_config.ho.in
libcwd/include/libcw/macro_AllocTag.h
libcwd/include/libcw/macro_ForAllDebugChannels.h
libcwd/include/libcw/macro_ForAllDebugObjects.h
libcwd/include/libcw/private_TSD.h
libcwd/include/libcw/private_allocator.h
libcwd/include/libcw/private_threading.h
libcwd/include/libcw/sysd.ho.in libcwd/include/libcw/type_info.h
Log message:
Don't use _REENTRANT in header files where we actually need to know
whether or not libcwd was compiled with threading support or not.
Don't define _REENTRANT ourselfs but pass -pthread to g++.
---------------------- diff included ----------------------
Index: src/libcwd/configure.in
diff -u src/libcwd/configure.in:1.92 src/libcwd/configure.in:1.93
--- src/libcwd/configure.in:1.92 Mon Jan 7 18:12:41 2002
+++ src/libcwd/configure.in Tue Jan 8 15:04:58 2002
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION($Revision: 1.92 $)dnl
+AC_REVISION($Revision: 1.93 $)dnl
dnl General intialization of `autoconf' varaibles.
dnl Ensure that the directory specified with --srcdir was correct
@@ -332,17 +332,18 @@
fi
AC_SUBST(CW_CONFIG_THREAD_SAFE)
-CW_CONFIG_THREAD_SAFE=0
+CW_CONFIG_THREAD_SAFE=undef
AC_SUBST(CW_CONFIG_HAVE_PTHREADS)
CW_CONFIG_HAVE_PTHREADS=undef
AC_SUBST(LIB_THREADS)
if test "$libcwd_config_threading" = yes; then
- dnl Check if we have libpthread.
- AC_CHECK_LIB(pthread, pthread_create,
+ dnl Check if we have POSIX threads
+ EXTRAOPTS="$EXTRAOPTS -pthread"
+ CXXFLAGS="$DEBUGOPTS $EXTRAOPTS"
+ AC_SEARCH_LIBS(pthread_create, pthread,
[AC_CHECK_HEADER(pthread.h,
- [CW_CONFIG_HAVE_PTHREADS=define
- LIB_THREADS=-lpthread],
+ [CW_CONFIG_HAVE_PTHREADS=define],
[AC_MSG_ERROR([
* Sorry but libcwd only supports POSIX Threads at the moment and I can't
@@ -351,15 +352,12 @@
])])],
[AC_MSG_ERROR([
-* Sorry but libcwd only supports POSIX Threads at the moment and I can't
-* find -lpthread. Use --disable-libcwd-threading to compile a libcwd that
-* is not thread safe.
+* Sorry but libcwd only supports POSIX Threads at the moment. Your libc doesn't
+* include posix threads by itself and I can't find -lpthread.
+* Use --disable-libcwd-threading to compile a libcwd that is not thread safe.
])])
-
- AC_DEFINE([LIBCWD_THREAD_SAFE])
- CW_CONFIG_THREAD_SAFE=1
- TESTOPTS=-D_REENTRANT
+ CW_CONFIG_THREAD_SAFE=define
SAVE_LIBS="$LIBS"
LIBS="$LIBS $LIB_THREADS"
AC_CHECK_FUNCS(pthread_kill_other_threads_np)
Index: src/libcwd/include/libcw/class_channel.h
diff -u src/libcwd/include/libcw/class_channel.h:1.2 src/libcwd/include/libcw/class_channel.h:1.3
--- src/libcwd/include/libcw/class_channel.h:1.2 Sat Dec 29 20:17:49 2001
+++ src/libcwd/include/libcw/class_channel.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_channel.h,v 1.2 2001/12/30 04:17:49 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_channel.h,v 1.3 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -82,15 +82,15 @@
class channel_ct {
private:
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
int WNS_index;
// A unique id that is used as index into the TSD array `off_cnt_array'.
-#else // !_REENTRANT
+#else // !LIBCWD_THREAD_SAFE
int off_cnt;
// A counter of the nested calls to off().
// The channel is turned off when the value of `off' is larger or equal then zero
// and `on' when it has the value -1.
-#endif // !_REENTRANT
+#endif // !LIBCWD_THREAD_SAFE
char WNS_label[max_label_len_c];
// A reference name for the represented debug channel
@@ -130,7 +130,7 @@
char const* get_label(void) const;
bool is_on(void) const;
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
bool is_on(LIBCWD_TSD_PARAM) const;
#endif
};
Index: src/libcwd/include/libcw/class_channel.inl
diff -u src/libcwd/include/libcw/class_channel.inl:1.2 src/libcwd/include/libcw/class_channel.inl:1.3
--- src/libcwd/include/libcw/class_channel.inl:1.2 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/class_channel.inl Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_channel.inl,v 1.2 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_channel.inl,v 1.3 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -38,7 +38,7 @@
NS_initialize(label);
}
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
__inline__
bool
channel_ct::is_on(LIBCWD_TSD_PARAM) const
@@ -55,7 +55,7 @@
bool
channel_ct::is_on(void) const
{
-#ifndef _REENTRANT
+#ifndef LIBCWD_THREAD_SAFE
return (off_cnt < 0);
#else
LIBCWD_TSD_DECLARATION
Index: src/libcwd/include/libcw/class_location.h
diff -u src/libcwd/include/libcw/class_location.h:1.2 src/libcwd/include/libcw/class_location.h:1.3
--- src/libcwd/include/libcw/class_location.h:1.2 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/class_location.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_location.h,v 1.2 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_location.h,v 1.3 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -64,7 +64,7 @@
public:
location_ct(void const* addr);
// Construct a location object for address `addr'.
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
location_ct(void const* addr LIBCWD_COMMA_TSD_PARAM);
// Idem, but with passing the TSD.
#endif
Index: src/libcwd/include/libcw/class_location.inl
diff -u src/libcwd/include/libcw/class_location.inl:1.2 src/libcwd/include/libcw/class_location.inl:1.3
--- src/libcwd/include/libcw/class_location.inl:1.2 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/class_location.inl Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_location.inl,v 1.2 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/class_location.inl,v 1.3 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -48,7 +48,7 @@
M_pc_location(addr LIBCWD_COMMA_TSD);
}
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
/**
* \brief Construct a location for address \p addr.
* \internal
Index: src/libcwd/include/libcw/debug_config.ho.in
diff -u src/libcwd/include/libcw/debug_config.ho.in:1.14 src/libcwd/include/libcw/debug_config.ho.in:1.15
--- src/libcwd/include/libcw/debug_config.ho.in:1.14 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/debug_config.ho.in Tue Jan 8 15:04:59 2002
@@ -1,5 +1,5 @@
// @configure_input@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/debug_config.ho.in,v 1.14 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/debug_config.ho.in,v 1.15 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -338,6 +338,7 @@
#@CW_CONFIG_HAVE_DLOPEN@ CWDEBUG_DLOPEN_DEFINED
#endif
+#@CW_CONFIG_THREAD_SAFE@ LIBCWD_THREAD_SAFE
#@CW_CONFIG_HAVE_PTHREADS@ LIBCWD_HAVE_PTHREAD
#endif // LIBCW_DEBUG_CONFIG_H
Index: src/libcwd/include/libcw/macro_AllocTag.h
diff -u src/libcwd/include/libcw/macro_AllocTag.h:1.3 src/libcwd/include/libcw/macro_AllocTag.h:1.4
--- src/libcwd/include/libcw/macro_AllocTag.h:1.3 Thu Jan 3 20:43:38 2002
+++ src/libcwd/include/libcw/macro_AllocTag.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/macro_AllocTag.h,v 1.3 2002/01/04 04:43:38 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/macro_AllocTag.h,v 1.4 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -147,16 +147,16 @@
#define AllocTag2(p, desc) ::libcw::debug::\
set_alloc_label(p, ::libcw::debug::type_info_of(p), const_cast<char const*>(desc))
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
#define LIBCWD_LOCK_desc__if_still_NULL_then ::libcw::debug::_private_::\
mutex_tct< ::libcw::debug::_private_::alloc_tag_desc_instance>::lock(); \
if (!desc)
#define LIBCWD_UNLOCK_desc ::libcw::debug::_private_::\
mutex_tct< ::libcw::debug::_private_::alloc_tag_desc_instance>::unlock();
-#else // !_REENTRANT
+#else // !LIBCWD_THREAD_SAFE
#define LIBCWD_LOCK_desc__if_still_NULL_then
#define LIBCWD_UNLOCK_desc
-#endif // !_REENTRANT
+#endif // !LIBCWD_THREAD_SAFE
/**
* \brief Annotate <I>type</I> of \a p with a static description.
Index: src/libcwd/include/libcw/macro_ForAllDebugChannels.h
diff -u src/libcwd/include/libcw/macro_ForAllDebugChannels.h:1.2 src/libcwd/include/libcw/macro_ForAllDebugChannels.h:1.3
--- src/libcwd/include/libcw/macro_ForAllDebugChannels.h:1.2 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/macro_ForAllDebugChannels.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/macro_ForAllDebugChannels.h,v 1.2 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/macro_ForAllDebugChannels.h,v 1.3 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -45,7 +45,7 @@
container_type* WNS_debug_channels;
public:
void init(void);
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
void init_and_rdlock(void);
#endif
container_type& write_locked(void);
@@ -78,15 +78,15 @@
} // namespace debug
} // namespace libcw
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
#define LIBCWD_ForAllDebugChannels_LOCK ::libcw::debug::_private_::\
debug_channels.init_and_rdlock();
#define LIBCWD_ForAllDebugChannels_UNLOCK ::libcw::debug::_private_::\
rwlock_tct< ::libcw::debug::_private_::debug_channels_instance>::rdunlock();
-#else // !_REENTRANT
+#else // !LIBCWD_THREAD_SAFE
#define LIBCWD_ForAllDebugChannels_LOCK ::libcw::debug::_private_::debug_channels.init();
#define LIBCWD_ForAllDebugChannels_UNLOCK
-#endif // !_REENTRANT
+#endif // !LIBCWD_THREAD_SAFE
/**
* \def ForAllDebugChannels
Index: src/libcwd/include/libcw/macro_ForAllDebugObjects.h
diff -u src/libcwd/include/libcw/macro_ForAllDebugObjects.h:1.2 src/libcwd/include/libcw/macro_ForAllDebugObjects.h:1.3
--- src/libcwd/include/libcw/macro_ForAllDebugObjects.h:1.2 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/macro_ForAllDebugObjects.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/macro_ForAllDebugObjects.h,v 1.2 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/macro_ForAllDebugObjects.h,v 1.3 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -47,7 +47,7 @@
container_type* WNS_debug_objects;
public:
void init(void);
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
void init_and_rdlock(void);
#endif
void ST_uninit(void);
@@ -81,15 +81,15 @@
} // namespace debug
} // namespace libcw
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
#define LIBCWD_ForAllDebugObjects_LOCK ::libcw::debug::_private_::\
debug_objects.init_and_rdlock();
#define LIBCWD_ForAllDebugObjects_UNLOCK ::libcw::debug::_private_::\
rwlock_tct< ::libcw::debug::_private_::debug_objects_instance>::rdunlock();
-#else // !_REENTRANT
+#else // !LIBCWD_THREAD_SAFE
#define LIBCWD_ForAllDebugObjects_LOCK ::libcw::debug::_private_::debug_objects.init();
#define LIBCWD_ForAllDebugObjects_UNLOCK
-#endif // !_REENTRANT
+#endif // !LIBCWD_THREAD_SAFE
/**
* \def ForAllDebugObjects
Index: src/libcwd/include/libcw/private_TSD.h
diff -u src/libcwd/include/libcw/private_TSD.h:1.3 src/libcwd/include/libcw/private_TSD.h:1.4
--- src/libcwd/include/libcw/private_TSD.h:1.3 Tue Jan 8 10:14:38 2002
+++ src/libcwd/include/libcw/private_TSD.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/private_TSD.h,v 1.3 2002/01/08 18:14:38 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/private_TSD.h,v 1.4 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2001, by
//
@@ -46,8 +46,8 @@
// Thread Specific Data (TSD) is stored in a structure TSD_st
// and is accessed through a reference to `__libcwd_tsd'.
-#ifndef _REENTRANT
-// When _REENTRANT is not defined then `__libcwd_tsd' is simply a global object in namespace _private_:
+#ifndef LIBCWD_THREAD_SAFE
+// When LIBCWD_THREAD_SAFE is not defined then `__libcwd_tsd' is simply a global object in namespace _private_:
extern TSD_st __libcwd_tsd;
#endif
extern int WST_initializing_TSD;
@@ -60,7 +60,7 @@
// (see LIBCWD_TSD_DECLARATION) or function parameter (LIBCWD_TSD_PARAM and LIBCWD_COMMA_TSD_PARAM).
// This approach means that many function signatures are different because with thread support a
// `__libcwd_tsd' reference needs to be passed. We use several helper macros for this:
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
#define LIBCWD_TSD __libcwd_tsd // Optional `__libcwd_tsd' parameter
// (foo() or foo(__libcwd_tsd)).
@@ -70,7 +70,7 @@
// (foo(void) or foo(TSD_st& __libcwd_tsd)).
#define LIBCWD_COMMA_TSD_PARAM , LIBCWD_TSD_PARAM
// Idem, but as second or higher parameter.
-#else // !_REENTRANT
+#else // !LIBCWD_THREAD_SAFE
#define LIBCWD_TSD
#define LIBCWD_COMMA_TSD
@@ -78,9 +78,9 @@
#define LIBCWD_COMMA_TSD_PARAM
// Put __libcwd_tsd in global namespace because anywhere we always refer to it
-// as `__libcwd_tsd' because when _REENTRANT is defined it is local variable.
+// as `__libcwd_tsd' because when LIBCWD_THREAD_SAFE is defined it is local variable.
using ::libcw::debug::_private_::__libcwd_tsd;
-#endif // !_REENTRANT
+#endif // !LIBCWD_THREAD_SAFE
#endif // LIBCW_TSD_H
Index: src/libcwd/include/libcw/private_allocator.h
diff -u src/libcwd/include/libcw/private_allocator.h:1.2 src/libcwd/include/libcw/private_allocator.h:1.3
--- src/libcwd/include/libcw/private_allocator.h:1.2 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/private_allocator.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/private_allocator.h,v 1.2 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/private_allocator.h,v 1.3 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2001, by
//
@@ -116,7 +116,7 @@
if ((__libcwd_tsd.internal > 0) != internal)
core_dump();
#endif
-#if defined(DEBUGDEBUG) && defined(_REENTRANT)
+#if defined(DEBUGDEBUG) && defined(LIBCWD_THREAD_SAFE)
if (instance == single_threaded_internal_instance && WST_multi_threaded)
core_dump();
if (instance >= 0 && WST_multi_threaded && !is_locked(instance))
@@ -236,32 +236,32 @@
true \
LIBCWD_DEBUGDEBUG_COMMA(::libcw::debug::_private_::instance)>
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
// Our allocator adaptor for the Non-Shared internal cases: Single Threaded
// (inst = single_threaded_internal_instance) or inside the critical area of the corresponding
// libcwd mutex instance. Using a macro here instead of another template in order not to bloat the
// mangling TOO much.
#define LIBCWD_NS_INTERNAL_ALLOCATOR(instance) \
DEFAULT_ALLOC_INTERNAL(instance)
-#else // !_REENTRANT
+#else // !LIBCWD_THREAD_SAFE
// In a single threaded application, the Non_shared case is equivalent to the Single Threaded case.
#define LIBCWD_NS_INTERNAL_ALLOCATOR(instance) \
DEFAULT_ALLOC_INTERNAL(single_threaded_internal_instance)
-#endif // !_REENTRANT
+#endif // !LIBCWD_THREAD_SAFE
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
// LIBCWD_MT_*_ALLOCATOR uses an different allocator than the normal default allocator of libstdc++
// in the case of multi-threading because it can be that the allocator mutex is locked, which would
// result in a deadlock if we try to use it again here.
#define LIBCWD_MT_INTERNAL_ALLOCATOR DEFAULT_ALLOC_INTERNAL(multi_threaded_internal_instance)
#define LIBCWD_MT_USERSPACE_ALLOCATOR DEFAULT_ALLOC_USRSPACE(multi_threaded_usrspace_instance)
-#else // !_REENTRANT
+#else // !LIBCWD_THREAD_SAFE
// LIBCWD_MT_*_ALLOCATOR uses the normal default allocator of libstdc++-v3 (alloc) using locking
// itself. The userspace allocator shares it memory pool with everything else (that uses this
// allocator, which is most of the (userspace) STL).
#define LIBCWD_MT_INTERNAL_ALLOCATOR DEFAULT_ALLOC_INTERNAL(single_threaded_internal_instance)
#define LIBCWD_MT_USERSPACE_ALLOCATOR DEFAULT_ALLOC_USRSPACE(single_threaded_userspace_instance)
-#endif // !_REENTRANT
+#endif // !LIBCWD_THREAD_SAFE
//---------------------------------------------------------------------------------------------------
// Internal allocator types.
Index: src/libcwd/include/libcw/private_threading.h
diff -u src/libcwd/include/libcw/private_threading.h:1.4 src/libcwd/include/libcw/private_threading.h:1.5
--- src/libcwd/include/libcw/private_threading.h:1.4 Tue Jan 8 10:14:38 2002
+++ src/libcwd/include/libcw/private_threading.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/private_threading.h,v 1.4 2002/01/08 18:14:38 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/private_threading.h,v 1.5 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2001, by
//
@@ -63,7 +63,7 @@
} // namespace debug
} // namespace libcw
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
#define LIBCWD_TSD_INSTANCE ::libcw::debug::_private_::\
thread_specific_data_tct< ::libcw::debug::_private_::TSD_st>::instance()
// For directly passing the `__libcwd_tsd' instance to a function (foo(TSD::instance())).
@@ -73,16 +73,16 @@
TSD_st& __libcwd_tsd(::libcw::debug::_private_::\
thread_specific_data_tct< ::libcw::debug::_private_::TSD_st>::instance());
// Declaration of local `__libcwd_tsd' structure reference.
-#else // !_REENTRANT
+#else // !LIBCWD_THREAD_SAFE
#define LIBCWD_TSD_INSTANCE
#define LIBCWD_COMMA_TSD_INSTANCE
#define LIBCWD_TSD_DECLARATION
-#endif // !_REENTRANT
+#endif // !LIBCWD_THREAD_SAFE
// End of Thread Specific Data
//===================================================================================================
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
namespace libcw {
namespace debug {
@@ -492,6 +492,6 @@
} // namespace debug
} // namespace libcw
-#endif // _REENTRANT
+#endif // LIBCWD_THREAD_SAFE
#endif // LIBCW_PRIVATE_THREADING_H
Index: src/libcwd/include/libcw/sysd.ho.in
diff -u src/libcwd/include/libcw/sysd.ho.in:1.4 src/libcwd/include/libcw/sysd.ho.in:1.5
--- src/libcwd/include/libcw/sysd.ho.in:1.4 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/sysd.ho.in Tue Jan 8 15:04:59 2002
@@ -1,5 +1,5 @@
// @configure_input@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/sysd.ho.in,v 1.4 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/sysd.ho.in,v 1.5 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -55,15 +55,19 @@
//
// Abort when someone tries to use MT with libcwd without MT support.
-#if defined(_REENTRANT) && !(@CW_CONFIG_THREAD_SAFE@)
+#@CW_CONFIG_THREAD_SAFE@ LIBCWD_TMP_THREAD_SAFE
+#if defined(_REENTRANT) && !defined(LIBCWD_TMP_THREAD_SAFE)
#error "Recompile libcwd with --enable-threading to enable support for Multi-Threading."
#endif
-#ifdef _REENTRANT
+#ifdef LIBCWD_TMP_THREAD_SAFE
// See http://www.cuj.com/experts/1902/alexandr.htm?topic=experts
#define LIBCWD_MT_VOLATILE volatile
#else
#define LIBCWD_MT_VOLATILE
#endif
+
+// Was only needed for the two tests above.
+#undef LIBCWD_TMP_THREAD_SAFE
#endif /* LIBCW_SYSD_H */
Index: src/libcwd/include/libcw/type_info.h
diff -u src/libcwd/include/libcw/type_info.h:1.15 src/libcwd/include/libcw/type_info.h:1.16
--- src/libcwd/include/libcw/type_info.h:1.15 Sat Dec 29 20:17:50 2001
+++ src/libcwd/include/libcw/type_info.h Tue Jan 8 15:04:59 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/type_info.h,v 1.15 2001/12/30 04:17:50 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/libcw/type_info.h,v 1.16 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -218,7 +218,7 @@
// We have to use the following hack.
if (::libcwd_type_info_exact<T>::value_c.size() == 0) // Not initialized already?
{
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
volatile static bool spin_lock = false;
_private_::mutex_tct<_private_::type_info_of_instance>::lock();
while(spin_lock);
@@ -231,7 +231,7 @@
new (const_cast<type_info_ct*>(&::libcwd_type_info_exact<T>::value_c)) // MT: const_cast is safe: we are locked.
type_info_ct(_private_::extract_exact_name(typeid(::libcwd_type_info_exact<T>).name() LIBCWD_COMMA_TSD), sizeof(T), _private_::sizeof_star<T>::value_c); // In place initialize the static type_info_ct object.
}
-#ifdef _REENTRANT
+#ifdef LIBCWD_THREAD_SAFE
spin_lock = false;
#endif
}
Index: src/libcwd/include/sys.ho.in
diff -u src/libcwd/include/sys.ho.in:1.6 src/libcwd/include/sys.ho.in:1.7
--- src/libcwd/include/sys.ho.in:1.6 Sat Jan 5 07:06:48 2002
+++ src/libcwd/include/sys.ho.in Tue Jan 8 15:04:59 2002
@@ -1,5 +1,5 @@
// @configure_input@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/sys.ho.in,v 1.6 2002/01/05 15:06:48 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/sys.ho.in,v 1.7 2002/01/08 23:04:59 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -22,13 +22,6 @@
//
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
-#endif
-
-//
-// Define _REENTRANT to make sure that the glibc functions are thread safe too.
-//
-#ifdef LIBCWD_THREAD_SAFE
-#define _REENTRANT
#endif
//
----------------------- End of diff -----------------------
|