It is not recommended for production use.
</p>
-->
- <p>Last updated: 2012-Mar-19<br />
+ <p>Last updated: 2012-Jun-05<br />
Copyright © 1997-2012 International Business Machines Corporation and
others. All Rights Reserved.</p>
<!-- Remember that there is a copyright at the end too -->
this release, see the <a href="http://site.icu-project.org/download/">ICU
download page</a>.</p>
+ <h3>Threading support cannot be removed</h3>
+ <p>ICU4C 50 drops the --enable-threads/--disable-threads option
+ and the uconfig.h <code>ICU_USE_THREADS</code> switch.
+ ICU4C 50 and higher is always built with multi-threading support.</p>
+
+ <p>If you need to disable multi-threading, then call
+ <code>u_setMutexFunctions()</code> and <code>u_setAtomicIncDecFunctions()</code>
+ with empty implementation functions.</p>
+
<h3>C++ namespace support required</h3>
<p>ICU4C 49 requires C++ namespace support.
As a result, for example, rather than <code>U_NAMESPACE_QUALIFIER UnicodeString</code>
<ul>
<li><tt>--disable-renaming</tt></li>
- <li><tt>--disable-threading</tt> (This flag does disable threading in ICU,
- but the resulting ICU library will still be linked with MSVC's multithread DLL)</li>
-
<li><tt>--enable-tracing</tt></li>
<li><tt>--enable-rpath</tt></li>
/*
******************************************************************************
*
-* Copyright (C) 1997-2011, International Business Machines
+* Copyright (C) 1997-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
# undef POSIX
#endif
-#if defined(POSIX) && (ICU_USE_THREADS==1)
+#if defined(POSIX)
# include <pthread.h> /* must be first, so that we get the multithread versions of things. */
-#endif /* POSIX && (ICU_USE_THREADS==1) */
+#endif /* POSIX */
#if U_PLATFORM_HAS_WIN32_API
# define WIN32_LEAN_AND_MEAN
*/
-#if (ICU_USE_THREADS == 0)
-#define MUTEX_TYPE void *
-#define PLATFORM_MUTEX_INIT(m)
-#define PLATFORM_MUTEX_LOCK(m)
-#define PLATFORM_MUTEX_UNLOCK(m)
-#define PLATFORM_MUTEX_DESTROY(m)
-#define PLATFORM_MUTEX_INITIALIZER NULL
-#define SYNC_COMPARE_AND_SWAP(dest, oldval, newval) \
- mutexed_compare_and_swap(dest, newval, oldval)
-
-
-#elif U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_HAS_WIN32_API
#define MUTEX_TYPE CRITICAL_SECTION
#define PLATFORM_MUTEX_INIT(m) InitializeCriticalSection(m)
#define PLATFORM_MUTEX_LOCK(m) EnterCriticalSection(m)
if (pIncFn) {
retVal = (*pIncFn)(gIncDecContext, p);
} else {
- #if !ICU_USE_THREADS
- /* ICU thread support compiled out. */
- retVal = ++(*p);
- #elif U_PLATFORM_HAS_WIN32_API
+ #if U_PLATFORM_HAS_WIN32_API
retVal = InterlockedIncrement((LONG*)p);
#elif defined(USE_MAC_OS_ATOMIC_INCREMENT)
retVal = OSAtomicIncrement32Barrier(p);
if (pDecFn) {
retVal = (*pDecFn)(gIncDecContext, p);
} else {
- #if !ICU_USE_THREADS
- /* ICU thread support compiled out. */
- retVal = --(*p);
- #elif U_PLATFORM_HAS_WIN32_API
+ #if U_PLATFORM_HAS_WIN32_API
retVal = InterlockedDecrement((LONG*)p);
#elif defined(USE_MAC_OS_ATOMIC_INCREMENT)
retVal = OSAtomicDecrement32Barrier(p);
/*
**********************************************************************
-* Copyright (C) 1997-2011, International Business Machines
+* Copyright (C) 1997-2012, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
#endif
#ifndef UMTX_FULL_BARRIER
-# if !ICU_USE_THREADS
-# define UMTX_FULL_BARRIER
-# elif U_HAVE_GCC_ATOMICS
+# if U_HAVE_GCC_ATOMICS
# define UMTX_FULL_BARRIER __sync_synchronize();
# elif defined(_MSC_VER) && _MSC_VER >= 1500
/* From MSVC intrin.h. Use _ReadWriteBarrier() only on MSVC 9 and higher. */
/*
******************************************************************************
-* Copyright (C) 2001-2011, International Business Machines
+* Copyright (C) 2001-2012, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: uclean.h
* directly access system functions for mutex operations
* This function can only be used when ICU is in an initial, unused state, before
* u_init() has been called.
- * This function may be used even when ICU has been built without multi-threaded
- * support (see ICU_USE_THREADS pre-processor variable, umutex.h)
* @param context This pointer value will be saved, and then (later) passed as
* a parameter to the user-supplied mutex functions each time they
* are called.
#define UCLN_NO_AUTO_CLEANUP 1
#endif
-/**
- * \def ICU_USE_THREADS
- *
- * Allows thread support (use of mutexes) to be compiled out of ICU.
- * Default: use threads.
- *
- * Even with thread support compiled out, applications may override the
- * (empty) mutex implementation with the u_setMutexFunctions() functions.
- * @internal
- */
-#ifdef ICU_USE_THREADS
- /* Use the predefined value. */
-#elif defined(APP_NO_THREADS)
- /* APP_NO_THREADS is an old symbol. We'll honour it if present. */
-# define ICU_USE_THREADS 0
-#else
-# define ICU_USE_THREADS 1
-#endif
-
/**
* \def U_DISABLE_RENAMING
* Determines whether to disable renaming or not.
GENCCODE_ASSEMBLY
HAVE_MMAP
LIB_THREAD
-ICU_USE_THREADS
-THREADS_TRUE
U_HAVE_STD_STRING
ENABLE_RPATH
U_ENABLE_DYLOAD
enable_tracing
enable_dyload
enable_rpath
-enable_threads
enable_weak_threads
enable_extras
enable_icuio
--enable-tracing enable function and data tracing default=no
--disable-dyload disable dynamic loading default=no
--enable-rpath use rpath when linking default is only if necessary
- --enable-threads build ICU with thread safety default=yes
--enable-weak-threads weakly reference the threading library default=no
--enable-extras build ICU extras default=yes
--enable-icuio build ICU's icuio library default=yes
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+# Always build ICU with multi-threading support.
threads=true
-
-# Enable/disable threads
-# Check whether --enable-threads was given.
-if test "${enable_threads+set}" = set; then :
- enableval=$enable_threads; case "${enableval}" in
- yes) threads=true ;;
- no) threads=false ;;
- *) as_fn_error $? "bad value ${enableval} for --enable-threads" "$LINENO" 5 ;;
- esac
-else
- threads=true
-fi
-
-
-if test "$threads" = true; then
- THREADS_TRUE=
-else
- THREADS_TRUE='#'
-fi
-
-ICU_USE_THREADS=0
+ICU_USE_THREADS=1
OLD_LIBS=${LIBS}
if test $threads = true; then
# Now that we're done using CPPFLAGS etc. for tests, we can change it
# for build.
-if test $ICU_USE_THREADS -ne 0
-then
- CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
- CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
- CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
-else
- CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DICU_USE_THREADS=0"
-fi
+CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
+CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
+CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
echo "ICU for C/C++ $VERSION is ready to be built."
echo "=== Important Notes: ==="
-if test $ICU_USE_THREADS = 0; then
- echo
- echo "** ICU was configured without mutex or thread support. Multithread-safe operation will not be tested. If this is unexpected, then run configure with --enable-threads=yes or check the messages above to see why thread support was not found." 1>&6
- echo
-fi
-
echo "Data Packaging: $datapackaging"
echo " This means: $datapackaging_msg"
echo " To locate data: $datapackaging_howfound"
AC_SUBST(U_HAVE_STD_STRING)
AC_LANG_POP([C++])
+# Always build ICU with multi-threading support.
threads=true
-
-# Enable/disable threads
-AC_ARG_ENABLE(threads,
- [ --enable-threads build ICU with thread safety [default=yes]],
- [case "${enableval}" in
- yes) threads=true ;;
- no) threads=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-threads) ;;
- esac],
- threads=true)
-ICU_CONDITIONAL(THREADS, test "$threads" = true)
-
-ICU_USE_THREADS=0
+ICU_USE_THREADS=1
OLD_LIBS=${LIBS}
if test $threads = true; then
esac
fi
-AC_SUBST(ICU_USE_THREADS)
-
AC_ARG_ENABLE(weak-threads,
[ --enable-weak-threads weakly reference the threading library [default=no]],
[case "${enableval}" in
# Now that we're done using CPPFLAGS etc. for tests, we can change it
# for build.
-if test $ICU_USE_THREADS -ne 0
-then
- CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
- CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
- CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
-else
- CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DICU_USE_THREADS=0"
-fi
+CPPFLAGS="$CPPFLAGS \$(THREADSCPPFLAGS)"
+CFLAGS="$CFLAGS \$(THREADSCFLAGS)"
+CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
AC_SUBST(LIBCFLAGS)
AC_SUBST(LIBCXXFLAGS)
echo "ICU for C/C++ $VERSION is ready to be built."
echo "=== Important Notes: ==="
-if test $ICU_USE_THREADS = 0; then
- echo
- echo "** ICU was configured without mutex or thread support. Multithread-safe operation will not be tested. If this is unexpected, then run configure with --enable-threads=yes or check the messages [above] to see why thread support was not found." 1>&6
- echo
-fi
-
echo "Data Packaging: $datapackaging"
echo " This means: $datapackaging_msg"
echo " To locate data: $datapackaging_howfound"
#include "unicode/fmtable.h"
#include "unicode/testlog.h"
+/**
+ * \def ICU_USE_THREADS
+ *
+ * Enables multi-threaded testing. Moved here from uconfig.h.
+ * Default: enabled
+ *
+ * This switched used to allow thread support (use of mutexes) to be compiled out of ICU.
+ */
+#ifdef ICU_USE_THREADS
+ /* Use the predefined value. */
+#elif defined(APP_NO_THREADS)
+ /* APP_NO_THREADS is an old symbol. We'll honour it if present. */
+# define ICU_USE_THREADS 0
+#else
+# define ICU_USE_THREADS 1
+#endif
+
U_NAMESPACE_USE
#if U_PLATFORM == U_PF_OS390
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1999-2011, International Business Machines Corporation and
+ * Copyright (c) 1999-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
#include "unicode/uloc.h"
#include "unicode/locid.h"
#include "putilimp.h"
+#include "intltest.h"
#include <stdio.h>
#include <string.h>
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1999-2011, International Business Machines Corporation and
+ * Copyright (c) 1999-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
#include "unicode/uloc.h"
#include "unicode/locid.h"
#include "putilimp.h"
+#include "intltest.h"
+#include "tsmthred.h"
#if U_PLATFORM_USES_ONLY_WIN32_API
/* Prefer native Windows APIs even if POSIX is implemented (i.e., on Cygwin). */
#undef sleep
#endif
-
-
-#include "tsmthred.h"
-
#define TSMTHREAD_FAIL(msg) errln("%s at file %s, line %d", msg, __FILE__, __LINE__)
#define TSMTHREAD_ASSERT(expr) {if (!(expr)) {TSMTHREAD_FAIL("Fail");}}