Add CGAL_HAS_THREADS.

This commit is contained in:
Sylvain Pion 2007-10-18 15:00:08 +00:00
parent f924e04db6
commit c5ad51a83c
2 changed files with 32 additions and 5 deletions

View File

@ -232,14 +232,24 @@ make_list(Iterator begin, Iterator end)
# define CGAL_make_list(begin, end) (begin, end)
#endif
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#define CGAL_DEPRECATED __attribute__((deprecated))
#elif _MSC_VER > 1300
#define CGAL_DEPRECATED __declspec(deprecated)
// Macro to trigger deprecation warnings
#if defined (__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
# define CGAL_DEPRECATED __attribute__((deprecated))
#elif defined (_MSC_VER) && (_MSC_VER > 1300)
# define CGAL_DEPRECATED __declspec(deprecated)
#else
#define CGAL_DEPRECATED
# define CGAL_DEPRECATED
#endif
// If CGAL_HAS_THREADS is not defined, then CGAL code assumes
// it can do any thread-unsafe things (like using static variables).
#if !defined CGAL_HAS_THREADS && !defined CGAL_HAS_NO_THREADS
#if defined BOOST_HAS_THREADS || defined _OPENMP
# define CGAL_HAS_THREADS
#endif
#endif
#endif // CGAL_CONFIG_H

View File

@ -154,5 +154,22 @@ Every release of \cgal\ defines the following preprocessor macros:
\end{description}
\section{Thread safety}
\cgal\ is progressively being made thread-safe. The guidelines which are followed
are:
\begin{itemize}
\item it should be possible to use different objects in different threads at
the same time (of the same type or not),
\item it is not safe to access the same object from different threads
at the same time.
\end{itemize}
If the macro \ccc{CGAL_HAS_THREADS} is not defined, then \cgal\ assumes it can use
any thread-unsafe code (such as static variables). By default, this macro is not
defined, unless \ccc{BOOST_HAS_THREADS} or \ccc{_OPENMP} is defined. It is possible
to force its definition on the command line, and it is possible to prevent its default
definition by setting \ccc{CGAL_HAS_NO_THREADS} from the command line.
\input{Introduction_ref/checks} % extra chapter